diff --git a/src/commands/Folders.ts b/src/commands/Folders.ts index c7fa5131..0a6cfe0a 100644 --- a/src/commands/Folders.ts +++ b/src/commands/Folders.ts @@ -438,9 +438,14 @@ export class Folders { public static getAbsFilePath(filePath: string): string { const wsFolder = Folders.getWorkspaceFolder(); const isWindows = process.platform === 'win32'; - let absPath = filePath.replace(WORKSPACE_PLACEHOLDER, parseWinPath(wsFolder?.fsPath || '')); - absPath = isWindows ? absPath.split('/').join('\\') : absPath; - return parseWinPath(absPath); + + if (filePath.includes(WORKSPACE_PLACEHOLDER)) { + let absPath = filePath.replace(WORKSPACE_PLACEHOLDER, parseWinPath(wsFolder?.fsPath || '')); + absPath = isWindows ? absPath.split('/').join('\\') : absPath; + return parseWinPath(absPath); + } + + return parseWinPath(join(parseWinPath(wsFolder?.fsPath || ''), filePath)); } /**