Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/filesystem/path-utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from "path";
import path from "path";
import os from 'os';

/**
Expand Down Expand Up @@ -77,6 +77,12 @@ export function normalizePath(p: string): string {
p = p.replace(/\\\\/g, '\\');
}

// On Windows, if we have a bare drive letter (e.g. "C:"), append a separator
// so path.normalize doesn't return "C:." which can break path validation.
if (process.platform === 'win32' && /^[a-zA-Z]:$/.test(p)) {
p = p + path.sep;
}

// Use Node's path normalization, which handles . and .. segments
let normalized = path.normalize(p);

Expand Down Expand Up @@ -116,3 +122,4 @@ export function expandHome(filepath: string): string {
}
return filepath;
}