mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-07 22:04:06 +08:00
fix: linux文件拷贝错误抛出异常
This commit is contained in:
parent
f3c7d3899b
commit
8e681c7a75
4
public/node_modules/clipboard-event/index.js
generated
vendored
4
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 target = path.resolve(targetPath, 'clipboard-event-handler-linux')
|
||||||
const p = path.join(__dirname, 'platform/clipboard-event-handler-linux')
|
const p = path.join(__dirname, 'platform/clipboard-event-handler-linux')
|
||||||
if(!existsSync(target)) {
|
if(!existsSync(target)) {
|
||||||
|
try {
|
||||||
mkdirSync(targetPath)
|
mkdirSync(targetPath)
|
||||||
copyFileSync(p, target)
|
copyFileSync(p, target)
|
||||||
chmodSync(target, 0o755)
|
chmodSync(target, 0o755)
|
||||||
|
} catch (error) {
|
||||||
|
this.emit('error', error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.child = execFile(target);
|
this.child = execFile(target);
|
||||||
}
|
}
|
||||||
|
@ -194,10 +194,7 @@ export default function initPlugin() {
|
|||||||
|
|
||||||
const registerClipEvent = (listener) => {
|
const registerClipEvent = (listener) => {
|
||||||
const errorHandler = () => {
|
const errorHandler = () => {
|
||||||
const info = '如监听失效 请手动安装 clipboard-event-handler-linux 到 ~/.local/bin'
|
utools.showNotification('剪贴板监听异常退出 请重启插件以开启监听')
|
||||||
utools.showNotification(
|
|
||||||
'剪贴板监听异常退出 请重启插件以开启监听' + (utools.isLinux() ? info : '')
|
|
||||||
)
|
|
||||||
utools.outPlugin()
|
utools.outPlugin()
|
||||||
}
|
}
|
||||||
listener
|
listener
|
||||||
@ -217,7 +214,10 @@ export default function initPlugin() {
|
|||||||
.on('close', errorHandler)
|
.on('close', errorHandler)
|
||||||
.on('exit', errorHandler)
|
.on('exit', errorHandler)
|
||||||
.on('error', (error) => {
|
.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()
|
utools.outPlugin()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -242,6 +242,7 @@ export default function initPlugin() {
|
|||||||
|
|
||||||
utools.onPluginOut((processExit) => {
|
utools.onPluginOut((processExit) => {
|
||||||
if (processExit) {
|
if (processExit) {
|
||||||
|
utools.showNotification('剪贴板监听异常退出 请重启插件以开启监听')
|
||||||
listener.stopListening()
|
listener.stopListening()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user