2016-09-17 31 views
0

控制檯日誌顯示:\用戶\ skhan \圖書館\應用支持\代碼\用戶\的summary.txt串無法在URI解析在vscode API

的循環使用,以取代斜線

在Windows,但在Ubuntu和Mac行不通其做工精細,這是OSX 10.11.6

的榜樣,但是當我嘗試使用API​​,我收到以下錯誤解析URI

threadService.ts:217 [分機主機]無法打開無標題:%5CUsers%5Cjdoe%5CLibrary%5CApplication%20Support%5CCode%5CUser%5Csummary.txt。詳細信息:期望的URI無標題:%5CUsers%5Cjdoet%5CLibrary%5CApplication%20Support%5CCode%5CUser%5Csummary.txt BUT GOT untitled:/Users/jdoe/Library/Application%20Support/Code/User/summary.txt(anonymous function) @ threadService.ts:217

以下是代碼

```

while (tempURI.indexOf("/") > -1) { 
      tempURI = tempURI.replace("/", "\\"); 
     } 

     console.log("FILE URI For Summary Page : " + tempURI); 

     var setting: vscode.Uri = vscode.Uri.parse("untitled:" + tempURI); //ERROR HERE 

     vscode.workspace.openTextDocument(setting).then((a: vscode.TextDocument) => { ... 

```

有anythings更多的我已經在做正確的URI解析?

回答

0

我用uri.parse.file使其文件和所有東西按預期工作