From 15cbcdf07d3c225063ea01fef7f47307fbff2ac8 Mon Sep 17 00:00:00 2001 From: Fabio Spampinato Date: Fri, 21 Jul 2017 20:56:20 +0200 Subject: [PATCH] Enforcing path normalization when opening files/folders --- src/utils.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index a0dae6c..ac03994 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -38,6 +38,8 @@ const Utils = { open ( filepath, isTextDocument = true ) { + filepath = path.normalize ( filepath ); + const fileuri = vscode.Uri.file ( filepath ); if ( isTextDocument ) { @@ -136,7 +138,11 @@ const Utils = { open ( folderpath, inNewWindow? ) { - vscode.commands.executeCommand ( 'vscode.openFolder', vscode.Uri.parse ( `file://${folderpath}` ), inNewWindow ); + folderpath = path.normalize ( folderpath ); + + const folderuri = vscode.Uri.file ( folderpath ); + + vscode.commands.executeCommand ( 'vscode.openFolder', folderuri, inNewWindow ); },