From 01d85ed419c46e9454d4e2b773b1ec94b4997d36 Mon Sep 17 00:00:00 2001 From: Eduardo Villalpando Mello Date: Fri, 3 Apr 2026 16:36:08 -0700 Subject: [PATCH 1/3] Use path.resolve for normalizing paths Prefer using path builtin method. Fixes #1181 --- src/common/utils/pathUtils.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/common/utils/pathUtils.ts b/src/common/utils/pathUtils.ts index d398828a..81ab75cb 100644 --- a/src/common/utils/pathUtils.ts +++ b/src/common/utils/pathUtils.ts @@ -58,11 +58,7 @@ function getComparisonKey(uri: Uri): string { } export function normalizePath(fsPath: string): string { - const path1 = fsPath.replace(/\\/g, '/'); - if (isWindows()) { - return path1.toLowerCase(); - } - return path1; + return path.resolve(fsPath); } export function getResourceUri(resourcePath: string, root?: string): Uri | undefined { From fbc454d0fcf417e68836df2cf3aa764d9b7244ea Mon Sep 17 00:00:00 2001 From: Eduardo Villalpando Mello Date: Fri, 3 Apr 2026 16:41:53 -0700 Subject: [PATCH 2/3] Lowercase path in windows --- src/common/utils/pathUtils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/utils/pathUtils.ts b/src/common/utils/pathUtils.ts index 81ab75cb..67f2587e 100644 --- a/src/common/utils/pathUtils.ts +++ b/src/common/utils/pathUtils.ts @@ -58,7 +58,8 @@ function getComparisonKey(uri: Uri): string { } export function normalizePath(fsPath: string): string { - return path.resolve(fsPath); + const resolvedPath = path.resolve(fsPath); + return isWindows() ? resolvedPath.toLowerCase() : resolvedPath; } export function getResourceUri(resourcePath: string, root?: string): Uri | undefined { From 3009f768523cb76fb990f1aebbf4aa522b388f3c Mon Sep 17 00:00:00 2001 From: Eduardo Villalpando Mello Date: Mon, 6 Apr 2026 14:26:47 -0700 Subject: [PATCH 3/3] Fix tests --- src/common/utils/pathUtils.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common/utils/pathUtils.ts b/src/common/utils/pathUtils.ts index 67f2587e..7f96a1a8 100644 --- a/src/common/utils/pathUtils.ts +++ b/src/common/utils/pathUtils.ts @@ -58,7 +58,7 @@ function getComparisonKey(uri: Uri): string { } export function normalizePath(fsPath: string): string { - const resolvedPath = path.resolve(fsPath); + const resolvedPath = path.resolve(fsPath).replace(/\\/g, '/'); return isWindows() ? resolvedPath.toLowerCase() : resolvedPath; } @@ -68,9 +68,8 @@ export function getResourceUri(resourcePath: string, root?: string): Uri | undef return undefined; } - const normalizedPath = normalizePath(resourcePath); - if (normalizedPath.includes('://')) { - return Uri.parse(normalizedPath); + if (resourcePath.includes('://')) { + return Uri.parse(resourcePath); } if (!path.isAbsolute(resourcePath) && root) {