diff --git a/public/node_modules/clipboard-event/index.js b/public/node_modules/clipboard-event/index.js index 91b290d..71342ef 100644 --- a/public/node_modules/clipboard-event/index.js +++ b/public/node_modules/clipboard-event/index.js @@ -22,9 +22,13 @@ class ClipboardEventListener extends EventEmitter { const target = path.resolve(targetPath, 'clipboard-event-handler-linux') const p = path.join(__dirname, 'platform/clipboard-event-handler-linux') if(!existsSync(target)) { - mkdirSync(targetPath) - copyFileSync(p, target) - chmodSync(target, 0o755) + try { + mkdirSync(targetPath) + copyFileSync(p, target) + chmodSync(target, 0o755) + } catch (error) { + this.emit('error', error) + } } this.child = execFile(target); } diff --git a/src/global/initPlugin.js b/src/global/initPlugin.js index 05ced4b..e65c656 100644 --- a/src/global/initPlugin.js +++ b/src/global/initPlugin.js @@ -194,10 +194,7 @@ export default function initPlugin() { const registerClipEvent = (listener) => { const errorHandler = () => { - const info = '如监听失效 请手动安装 clipboard-event-handler-linux 到 ~/.local/bin' - utools.showNotification( - '剪贴板监听异常退出 请重启插件以开启监听' + (utools.isLinux() ? info : '') - ) + utools.showNotification('剪贴板监听异常退出 请重启插件以开启监听') utools.outPlugin() } listener @@ -217,7 +214,10 @@ export default function initPlugin() { .on('close', errorHandler) .on('exit', errorHandler) .on('error', (error) => { - utools.showNotification('剪贴板监听出错' + error) + const info = '请手动安装 clipboard-event-handler-linux 到 ~/.local/bin' + const site = 'https://ziuchen.gitee.io/project/ClipboardManager/guide/' + utools.showNotification('启动剪贴板监听出错: ' + error + info) + utools.shellOpenExternal(site) utools.outPlugin() }) } @@ -242,6 +242,7 @@ export default function initPlugin() { utools.onPluginOut((processExit) => { if (processExit) { + utools.showNotification('剪贴板监听异常退出 请重启插件以开启监听') listener.stopListening() } })