Files
openchamber/packages/vscode/src/pathUtils.ts
T
pttydou ed987a576d fix(vscode): normalize status path comparison (#3322)
Closes #3308. Thanks for fixing the misleading Windows status diagnostic and adding the focused regression tests.
2026-09-05 02:13:54 +03:00

13 lines
613 B
TypeScript

/**
* Normalize Windows drive letter to uppercase.
*
* VS Code's `workspaceFolders[0].uri.fsPath` returns lowercase drive letters (e.g. `d:\...`),
* while process.cwd() (used by OpenCode server) returns uppercase (e.g. `D:\...`).
* Normalize to uppercase so session directory queries match.
*/
export const normalizeWindowsDriveLetter = (p: string): string =>
p.replace(/^([a-z]):/, (_, letter: string) => letter.toUpperCase() + ':');
export const pathsEqualWithNormalizedDriveLetter = (left: string, right: string): boolean =>
normalizeWindowsDriveLetter(left) === normalizeWindowsDriveLetter(right);