Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 96a5821

Browse files
committed
Update wslUtils.ts
patch to solve wslpath fail when path not exists
1 parent 4066e02 commit 96a5821

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/utils/wslUtils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,8 @@ export async function toWslPath(path: string): Promise<string> {
1515
}
1616

1717
export async function toWinPath(path: string): Promise<string> {
18-
return (await executeCommand("wsl", ["wslpath", "-w", `"${path}"`])).trim();
18+
if (path.startsWith("\\mnt\\")) {
19+
return (await executeCommand("wsl", ["wslpath", "-w", `"${path.replace(/\\/g, "/").substr(0, 6)}"`])).trim() + path.substr(7);
20+
}
21+
return (await executeCommand("wsl", ["wslpath", "-w", "/"])).trim() + path;
1922
}

0 commit comments

Comments
 (0)