From a2a070d471857d50b798d7fff944b8f49951924a Mon Sep 17 00:00:00 2001 From: fofolee Date: Sun, 28 Mar 2021 10:25:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=BB=88=E7=AB=AF=20bug=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- src/README.md | 2 +- src/assets/js/init.js | 2 +- src/plugin.json | 2 +- src/preload.js | 39 ++++----------------------------------- 5 files changed, 8 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 2c243f1..cdf6a97 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# 快捷命令 V2.3.4 +# 快捷命令 V2.3.5 [![GitHub stars](https://img.shields.io/github/stars/fofolee/uTools-quickcommand?style=flat-square)](https://github.com/fofolee/uTools-quickcommand/stargazers) [![GitHub forks](https://img.shields.io/github/forks/fofolee/uTools-quickcommand?style=flat-square)](https://github.com/fofolee/uTools-quickcommand/network/members) [![GitHub license](https://img.shields.io/github/license/fofolee/uTools-quickcommand?style=flat-square)](https://github.com/fofolee/uTools-quickcommand/blob/master/LICENSE) [![version]( https://img.shields.io/badge/dynamic/json?color=f58142&label=version&query=%24.version&url=https%3A%2F%2Fraw.githubusercontent.com%2Ffofolee%2FuTools-quickcommand%2Fmaster%2Fsrc%2Fplugin.json&style=flat-square)](https://github.com/fofolee/uTools-quickcommand/blob/master/src/helps/CHANGELOG.md) [![猿料](https://img.shields.io/badge/%E7%8C%BF%E6%96%99-%2Fd%2F424-red?style=flat-square)](https://yuanliao.info/d/424) [![评论](https://img.shields.io/badge/dynamic/json?color=%2350e3c2&label=%E8%AF%84%E8%AE%BA&query=%24.data.attributes.commentCount&url=https%3A%2F%2Fyuanliao.info%2Fapi%2Fdiscussions%2F424&style=flat-square)](https://yuanliao.info/d/424) [![下载](https://img.shields.io/badge/dynamic/json?label=%E4%B8%8B%E8%BD%BD&query=quickcommand&url=https%3A%2F%2Ffofolee.cn1.utools.club%2Fapi%2Fqcdownloads&style=flat-square)](https://yuanliao.info/d/424) diff --git a/src/README.md b/src/README.md index 2c243f1..cdf6a97 100644 --- a/src/README.md +++ b/src/README.md @@ -1,6 +1,6 @@ -# 快捷命令 V2.3.4 +# 快捷命令 V2.3.5 [![GitHub stars](https://img.shields.io/github/stars/fofolee/uTools-quickcommand?style=flat-square)](https://github.com/fofolee/uTools-quickcommand/stargazers) [![GitHub forks](https://img.shields.io/github/forks/fofolee/uTools-quickcommand?style=flat-square)](https://github.com/fofolee/uTools-quickcommand/network/members) [![GitHub license](https://img.shields.io/github/license/fofolee/uTools-quickcommand?style=flat-square)](https://github.com/fofolee/uTools-quickcommand/blob/master/LICENSE) [![version]( https://img.shields.io/badge/dynamic/json?color=f58142&label=version&query=%24.version&url=https%3A%2F%2Fraw.githubusercontent.com%2Ffofolee%2FuTools-quickcommand%2Fmaster%2Fsrc%2Fplugin.json&style=flat-square)](https://github.com/fofolee/uTools-quickcommand/blob/master/src/helps/CHANGELOG.md) [![猿料](https://img.shields.io/badge/%E7%8C%BF%E6%96%99-%2Fd%2F424-red?style=flat-square)](https://yuanliao.info/d/424) [![评论](https://img.shields.io/badge/dynamic/json?color=%2350e3c2&label=%E8%AF%84%E8%AE%BA&query=%24.data.attributes.commentCount&url=https%3A%2F%2Fyuanliao.info%2Fapi%2Fdiscussions%2F424&style=flat-square)](https://yuanliao.info/d/424) [![下载](https://img.shields.io/badge/dynamic/json?label=%E4%B8%8B%E8%BD%BD&query=quickcommand&url=https%3A%2F%2Ffofolee.cn1.utools.club%2Fapi%2Fqcdownloads&style=flat-square)](https://yuanliao.info/d/424) diff --git a/src/assets/js/init.js b/src/assets/js/init.js index fdb1305..3bdc18e 100644 --- a/src/assets/js/init.js +++ b/src/assets/js/init.js @@ -38,7 +38,7 @@ let oldVersionFix = () => { } let showChangeLog = () => { - let ignoreVersions = [] + let ignoreVersions = ['2.3.5'] if (ignoreVersions.includes(pluginInfo().version)) return UTOOLS.putDB(pluginInfo().version, UTOOLS.DBPRE.CFG + 'version') utools.createBrowserWindow('./helps/CHANGELOG.html', { width: 1280, height: 920 }) diff --git a/src/plugin.json b/src/plugin.json index 8c92ac5..45f91e5 100644 --- a/src/plugin.json +++ b/src/plugin.json @@ -4,7 +4,7 @@ "main": "index.html", "homepage": "https://github.com/fofolee/uTools-quickcommand", "publishPage": "https://yuanliao.info/d/424", - "version": "2.3.4", + "version": "2.3.5", "author": "云之轩", "unpack":"autopep8.py", "logo": "logo.png", diff --git a/src/preload.js b/src/preload.js index 7632bbc..9819bda 100644 --- a/src/preload.js +++ b/src/preload.js @@ -389,13 +389,13 @@ if (process.platform == 'win32') quickcommand.runVbs = function (script) { // 在终端中执行 if (process.platform !== 'linux') quickcommand.runInTerminal = function (cmdline, dir) { - let command = getCommandToLaunchTerminal(cmdline.replace(/"/g, `\\"`), dir) - console.log(command); + let command = getCommandToLaunchTerminal(cmdline, dir) child_process.exec(command) } let getCommandToLaunchTerminal = (cmdline, dir) => { let cd = '' + cmdline = cmdline.replace(/"/g, `\\"`) if (utools.isWindows()) { let wtpath = path.join(utools.getPath('home'), '/AppData/Local/Microsoft/WindowsApps/wt.exe') if (fs.existsSync(wtpath)) { @@ -406,15 +406,9 @@ let getCommandToLaunchTerminal = (cmdline, dir) => { command = `${cd} start "" cmd /k "${cmdline}"` } } else { - let iterm - if (fs.existsSync('/Applications/iTerm 2.app')) { - iterm = 'iTerm 2' - } else if (fs.existsSync('/Applications/iTerm.app')) { - iterm = 'iTerm' - } if (dir) cd = `cd ${dir.replace(/ /g, `\\\\ `)} &&` - if (iterm) { - command = `osascript -e 'tell application "${iterm}" + if (fs.existsSync('/Applications/iTerm.app')) { + command = `osascript -e 'tell application "iTerm" create window with default profile tell current session of current window to write text "clear && ${cd} ${cmdline}" end tell'` @@ -849,31 +843,6 @@ runCodeFile = (cmd, option, terminal, callback) => { } // 在终端中输出 if (terminal) cmdline = getCommandToLaunchTerminal(cmdline) - // if (terminal) { - // if (utools.isWindows()) { - // if (bin.slice(-7) == 'csc.exe' || bin == 'gcc') { - // cmdline = cmdline.split("&&") - // cmdline = cmdline[0] + "&& start cmd /k " + cmdline[1] - // } else { - // cmdline = `start cmd /k ${cmdline}` - // } - // } else if(utools.isMacOs()){ - // var appleScript = `if application "Terminal" is running then - // tell application "Terminal" - // do script "clear;${cmdline.replace(/"/g, `\\"`)}" - // activate - // end tell - // else - // tell application "Terminal" - // do script "clear;${cmdline.replace(/"/g, `\\"`)}" in window 1 - // activate - // end tell - // end if`; - // cmdline = `osascript -e '${appleScript}'` - // } else { - // return message('Linux 不支持在终端输出') - // } - // } child = child_process.spawn(cmdline, { encoding: 'buffer', shell: true }) // var chunks = [], // err_chunks = [];