From 5caf3e898c691da40154c01546a74cae52f5b926 Mon Sep 17 00:00:00 2001 From: mohuishou <1@lailin.xyz> Date: Fri, 2 Apr 2021 11:26:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20windows=20=E4=B8=8B?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20code=20=E5=91=BD=E4=BB=A4=E4=B8=8D?= =?UTF-8?q?=E7=94=9F=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/vscode/plugin.json | 2 +- plugins/vscode/src/vscode.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/vscode/plugin.json b/plugins/vscode/plugin.json index ee8e217..0ffef23 100644 --- a/plugins/vscode/plugin.json +++ b/plugins/vscode/plugin.json @@ -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", diff --git a/plugins/vscode/src/vscode.ts b/plugins/vscode/src/vscode.ts index 63ff21e..58a9139 100644 --- a/plugins/vscode/src/vscode.ts +++ b/plugins/vscode/src/vscode.ts @@ -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();