mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-08-04 12:47:43 +08:00
✨ Feature: add workflow for mac
for uploading images from context menu in macOS
This commit is contained in:
23
src/main/utils/beforeOpen.js
Normal file
23
src/main/utils/beforeOpen.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import fs from 'fs-extra'
|
||||
import path from 'path'
|
||||
import os from 'os'
|
||||
if (process.env.NODE_ENV !== 'development') {
|
||||
global.__static = path.join(__dirname, '/static').replace(/\\/g, '\\\\')
|
||||
}
|
||||
if (process.env.DEBUG_ENV === 'debug') {
|
||||
global.__static = path.join(__dirname, '../../../static').replace(/\\/g, '\\\\')
|
||||
}
|
||||
function beforeOpen () {
|
||||
const dest = `${os.homedir}/Library/Services/Upload pictures with PicGo.workflow`
|
||||
if (fs.existsSync(dest)) {
|
||||
return true
|
||||
} else {
|
||||
try {
|
||||
fs.copySync(path.join(__static, 'Upload pictures with PicGo.workflow'), dest)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default beforeOpen
|
||||
Reference in New Issue
Block a user