pwd获取失败时返回桌面

This commit is contained in:
fofolee 2020-07-05 10:54:58 +08:00
parent 03a1f3bba5
commit a0ad692ad8

View File

@ -19,11 +19,9 @@
putDB('history', { cmd: cmd, program: program, scptarg: scptarg, customoptions: customoptions }, 'codeHistory') putDB('history', { cmd: cmd, program: program, scptarg: scptarg, customoptions: customoptions }, 'codeHistory')
} }
// 初始化 // 初始化
$("#options").empty() $("#options, #out").empty()
$("#out").empty() $('body').children(':not(#wrapper)').remove()
$("[id^=quick").remove()
$('body').css({overflow: 'hidden'}) $('body').css({overflow: 'hidden'})
swal.close()
if (handleEnter) document.removeEventListener('keydown', handleEnter) if (handleEnter) document.removeEventListener('keydown', handleEnter)
}) })
// 配置页面 // 配置页面
@ -65,7 +63,7 @@
} }
// 获取资源管理器或访达当前目录 // 获取资源管理器或访达当前目录
if (cmd.includes('{{pwd}}')) { if (cmd.includes('{{pwd}}')) {
let repl = utools.getCurrentFolderPath().replace(/\\/g, '\\\\'); let repl = getCurrentFolderPathFix();
cmd = cmd.replace(/\{\{pwd\}\}/mg, repl) cmd = cmd.replace(/\{\{pwd\}\}/mg, repl)
} }
// 获取窗口信息 // 获取窗口信息
@ -128,7 +126,7 @@
let switchQuickCommandResult = (stdout, stderr, outputOpts) => { let switchQuickCommandResult = (stdout, stderr, outputOpts) => {
var output = outputOpts.type, autoScroll = outputOpts.autoScroll, autoHeight = outputOpts.autoHeight; var output = outputOpts.type, autoScroll = outputOpts.autoScroll, autoHeight = outputOpts.autoHeight;
var outputAutoFix = (autoScroll, autoHeight) => { var outputAutoFix = (autoScroll, autoHeight) => {
var outputHeight = $("#out").height() + 20 var outputHeight = $("#out").outerHeight()
if (outputHeight > 600) outputHeight = 600 if (outputHeight > 600) outputHeight = 600
if (autoHeight && $('#options').is(':hidden')) utools.setExpendHeight(outputHeight); if (autoHeight && $('#options').is(':hidden')) utools.setExpendHeight(outputHeight);
if (outputHeight == 600 && autoScroll) $(document).scrollTop($(document).height()); if (outputHeight == 600 && autoScroll) $(document).scrollTop($(document).height());