Skip to content

Commit

Permalink
fix: 修复 windows 下使用 code 命令不生效的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
mohuishou committed Apr 2, 2021
1 parent b266984 commit 5caf3e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/vscode/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "830ef6d0",
"pluginName": "vscode",
"description": "快速搜索vscode历史项目并且在vscode中打开",
"version": "v3.0.2",
"version": "v3.0.3",
"preload": "dist/preload.js",
"author": "莫回首",
"homepage": "https://github.com/mohuishou/utools",
Expand Down
9 changes: 7 additions & 2 deletions plugins/vscode/src/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,15 @@ export class VSCode implements Plugin {
}

select(item: ListItem) {
let cmd = `"${Setting.Get("code")}" --folder-uri "${item.description}"`;
let code = Setting.Get("code");
if (code.trim().includes(" ")) {
code = `"${code}"`;
}

let cmd = `${code} --folder-uri "${item.description}"`;
let shell = Setting.Get("shell");
if (shell.trim()) {
cmd = shell + ` '${cmd}'`;
cmd = shell + ` "${cmd}"`;
}
let res = execSync(cmd, { timeout: 3000 }).toString().trim().toLowerCase();
if (res !== "" && !res.toLowerCase().includes("timeout")) throw res.toString();
Expand Down

0 comments on commit 5caf3e8

Please sign in to comment.