Skip to content

Commit 89fd9e8

Browse files
committed
Fixes issues w/ leading / on windows paths
1 parent 4525d7e commit 89fd9e8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/system/path.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { isLinux, isWindows } from '@env/platform';
33

44
export { basename, dirname, extname, join as joinPaths } from 'path';
55

6-
const driveLetterNormalizeRegex = /(?<=^\/?)([A-Z])(?=:\/)/;
6+
const driveLetterNormalizeRegex = /(^\/?)([a-zA-Z])(?=:\/)/;
77
const hasSchemeRegex = /^([a-zA-Z][\w+.-]+):/;
88
const pathNormalizeRegex = /\\/g;
99
const slash = 47;
@@ -71,8 +71,8 @@ export function normalizePath(path: string): string {
7171
}
7272

7373
if (isWindows) {
74-
// Ensure that drive casing is normalized (lower case)
75-
path = path.replace(driveLetterNormalizeRegex, d => d.toLowerCase());
74+
// Ensure that drive casing is normalized (lower case) and no leading slash
75+
path = path.replace(driveLetterNormalizeRegex, (_, _slash, d: string) => d.toLowerCase());
7676
}
7777

7878
return path;

0 commit comments

Comments
 (0)