mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-06 13:24:06 +08:00
fix: linux文件拷贝错误抛出异常
This commit is contained in:
parent
f3c7d3899b
commit
8e681c7a75
10
public/node_modules/clipboard-event/index.js
generated
vendored
10
public/node_modules/clipboard-event/index.js
generated
vendored
@ -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);
|
||||
}
|
||||
|
@ -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()
|
||||
}
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user