From 2423b7351d8599986e2804dc25a053e548c3cfb5 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Fri, 6 Oct 2023 14:29:06 +0200 Subject: [PATCH] Abs path --- src/commands/Folders.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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)); } /**