Skip to content

Commit

Permalink
fix: 修复项目路径存在特殊字符可能无法正常打开项目的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mohuishou committed Sep 11, 2024
1 parent 924d7ed commit 28f28b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions plugins/vscode/src/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export async function GetFiles(path: string) {
let data = JSON.parse(res) as Recent;

return data.entries.map((file) => {
if (typeof file === "string") return decodeURIComponent(file);
if (typeof file === "string") return file;
let path = file.fileUri || file.folderUri || file.workspace.configPath;
return decodeURIComponent(path);
return path;
});
}
16 changes: 9 additions & 7 deletions plugins/vscode/src/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ export class VSCode implements Plugin {
});
});

let items = files.map((file: any): ListItem => {
let item = new ListItem(basename(file), file);
let ext = file.includes("remote") ? ".remote" : extname(file);
item.icon = this.getIcon(ext);
return item;
});
let items = files.map(
(file: any): ListItem => {
let item = new ListItem(basename(decodeURIComponent(file)), file);
let ext = file.includes("remote") ? ".remote" : extname(file);
item.icon = this.getIcon(ext);
return item;
}
);

if (!word.trim()) {
let collects = this.getCollect();
Expand Down Expand Up @@ -163,7 +165,7 @@ export class VSCode implements Plugin {
this.execCmd(cmd, {
timeout: timeout,
windowsHide: true,
encoding: "utf-8"
encoding: "utf-8",
})
.then(() => {
utools.hideMainWindow();
Expand Down

0 comments on commit 28f28b9

Please sign in to comment.