fix(paths): Add cross-platform path normalization (#18939)

This commit is contained in:
Spencer
2026-02-17 17:52:55 -05:00
committed by GitHub
parent 4fe86dbd4f
commit 5e2f5df62c
3 changed files with 75 additions and 56 deletions
+4 -2
View File
@@ -319,13 +319,15 @@ export function getProjectHash(projectRoot: string): string {
}
/**
* Normalizes a path for reliable comparison.
* Normalizes a path for reliable comparison across platforms.
* - Resolves to an absolute path.
* - Converts all path separators to forward slashes.
* - On Windows, converts to lowercase for case-insensitivity.
*/
export function normalizePath(p: string): string {
const resolved = path.resolve(p);
return process.platform === 'win32' ? resolved.toLowerCase() : resolved;
const normalized = resolved.replace(/\\/g, '/');
return process.platform === 'win32' ? normalized.toLowerCase() : normalized;
}
/**