summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extension/src/util/vscode.ts16
1 files changed, 13 insertions, 3 deletions
diff --git a/extension/src/util/vscode.ts b/extension/src/util/vscode.ts
index 861ecd14..92bbc110 100644
--- a/extension/src/util/vscode.ts
+++ b/extension/src/util/vscode.ts
@@ -104,13 +104,23 @@ export function openEditorAndRevealRange(
});
}
+function windowsToPosix(windowsPath: string): string {
+ let posixPath = windowsPath.split("\\").join("/");
+ if (posixPath[1] === ":") {
+ posixPath = posixPath.slice(2);
+ }
+ posixPath = posixPath.replace(" ", "\\ ");
+ return posixPath;
+}
+
export function uriFromFilePath(filepath: string): vscode.Uri {
if (vscode.env.remoteName) {
if (
- vscode.env.remoteName === "wsl" ||
- vscode.env.remoteName === "ssh-remote"
+ (vscode.env.remoteName === "wsl" ||
+ vscode.env.remoteName === "ssh-remote") &&
+ process.platform === "win32"
) {
- filepath = filepath.replace(/\\/g, "/");
+ filepath = windowsToPosix(filepath);
}
return vscode.Uri.parse(
`vscode-remote://${vscode.env.remoteName}${filepath}`