mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-06-29 20:32:44 +08:00
开发模式下方便调试
This commit is contained in:
parent
9872a08968
commit
09d254cd2a
@ -219,22 +219,22 @@ if (process.platform !== 'linux') quickcommand.runInTerminal = function(cmdline,
|
|||||||
}
|
}
|
||||||
|
|
||||||
let getCommandToLaunchTerminal = (cmdline, dir) => {
|
let getCommandToLaunchTerminal = (cmdline, dir) => {
|
||||||
let cd = ''
|
let cd = ''
|
||||||
if (utools.isWindows()) {
|
if (utools.isWindows()) {
|
||||||
let appPath = path.join(utools.getPath('home'), '/AppData/Local/Microsoft/WindowsApps/')
|
let appPath = path.join(utools.getPath('home'), '/AppData/Local/Microsoft/WindowsApps/')
|
||||||
// 直接 existsSync wt.exe 无效
|
// 直接 existsSync wt.exe 无效
|
||||||
if (fs.existsSync(appPath) && fs.readdirSync(appPath).includes('wt.exe')) {
|
if (fs.existsSync(appPath) && fs.readdirSync(appPath).includes('wt.exe')) {
|
||||||
cmdline = cmdline.replace(/"/g, `\\"`)
|
cmdline = cmdline.replace(/"/g, `\\"`)
|
||||||
if (dir) cd = `-d "${dir.replace(/\\/g, '/')}"`
|
if (dir) cd = `-d "${dir.replace(/\\/g, '/')}"`
|
||||||
command = `${appPath}wt.exe ${cd} cmd /k "${cmdline}"`
|
command = `${appPath}wt.exe ${cd} cmd /k "${cmdline}"`
|
||||||
|
} else {
|
||||||
|
cmdline = cmdline.replace(/"/g, `^"`)
|
||||||
|
if (dir) cd = `cd /d "${dir.replace(/\\/g, '/')}" &&`
|
||||||
|
command = `${cd} start "" cmd /k "${cmdline}"`
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
cmdline = cmdline.replace(/"/g, `^"`)
|
cmdline = cmdline.replace(/"/g, `\\"`)
|
||||||
if (dir) cd = `cd /d "${dir.replace(/\\/g, '/')}" &&`
|
if (dir) cd = `cd ${dir.replace(/ /g, `\\\\ `)} &&`
|
||||||
command = `${cd} start "" cmd /k "${cmdline}"`
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
cmdline = cmdline.replace(/"/g, `\\"`)
|
|
||||||
if (dir) cd = `cd ${dir.replace(/ /g, `\\\\ `)} &&`
|
|
||||||
if (fs.existsSync('/Applications/iTerm.app')) {
|
if (fs.existsSync('/Applications/iTerm.app')) {
|
||||||
command = `osascript -e 'tell application "iTerm"
|
command = `osascript -e 'tell application "iTerm"
|
||||||
create window with default profile
|
create window with default profile
|
||||||
@ -499,6 +499,8 @@ let liteErr = e => {
|
|||||||
return e.error ? e.error.stack.replace(/([ ] +at.+)|(.+\.js:\d+)/g, '').trim() : e.message
|
return e.error ? e.error.stack.replace(/([ ] +at.+)|(.+\.js:\d+)/g, '').trim() : e.message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
utools.isDev() && (window.godMode = code => eval(code))
|
||||||
|
|
||||||
// vm 模块将无法在渲染进程中使用,改用简单的沙箱来执行代码
|
// vm 模块将无法在渲染进程中使用,改用简单的沙箱来执行代码
|
||||||
let createSandbox = (code, sandbox, async = false) => {
|
let createSandbox = (code, sandbox, async = false) => {
|
||||||
if (!async) code = `return (${code})`
|
if (!async) code = `return (${code})`
|
||||||
@ -676,4 +678,4 @@ window.quickcommandHttpServer = () => {
|
|||||||
run,
|
run,
|
||||||
stop
|
stop
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -29,7 +29,7 @@ export default defineComponent({
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
window.root = this;
|
utools.isDev() && (window.root = this);
|
||||||
window.utools = window.getuToolsLite();
|
window.utools = window.getuToolsLite();
|
||||||
if (!this.checkVer()) return;
|
if (!this.checkVer()) return;
|
||||||
this.startUp();
|
this.startUp();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user