mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-21 16:20:46 +08:00
🐛 Fix(custom): fix resources path
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import os from 'node:os'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
import { dbPathChecker } from '@core/datastore/dbChecker'
|
||||
import fs from 'fs-extra'
|
||||
@@ -10,6 +11,7 @@ import { i18nManager } from '~/i18n'
|
||||
|
||||
const configPath = dbPathChecker()
|
||||
const CONFIG_DIR = path.dirname(configPath)
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
function beforeOpen () {
|
||||
if (process.platform === 'darwin') {
|
||||
@@ -46,7 +48,7 @@ function copyFileOutsideOfElectronAsar (sourceInAsarArchive: string, destOutside
|
||||
function resolveMacWorkFlow () {
|
||||
const dest = `${os.homedir()}/Library/Services/Upload pictures with PicList.workflow`
|
||||
try {
|
||||
copyFileOutsideOfElectronAsar(path.join('./resources', 'Upload pictures with PicList.workflow'), dest)
|
||||
copyFileOutsideOfElectronAsar(path.join(__dirname, '../../resources', 'Upload pictures with PicList.workflow'), dest)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
@@ -86,7 +88,7 @@ function resolveClipboardImageGenerator () {
|
||||
|
||||
return files.map(item => {
|
||||
return {
|
||||
origin: path.join('./resources', item),
|
||||
origin: path.join(__dirname, '../../resources', item),
|
||||
dest: path.join(CONFIG_DIR, item)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user