增加打包版

This commit is contained in:
2025-08-22 08:13:56 +08:00
parent 0cc890f440
commit 8729025b04
6 changed files with 146 additions and 7 deletions
+11 -1
View File
@@ -7,7 +7,17 @@ const path = require('path')
*/
class ConfigManager {
constructor() {
this.configDir = path.join(__dirname, 'user-config.json')
// 检测是否在pkg打包环境中运行
const isPkg = process.pkg !== undefined;
if (isPkg) {
// 在打包环境中,使用可执行文件所在目录
this.configDir = path.join(process.cwd(), 'data', 'user-config.json')
} else {
// 在开发环境中,使用相对路径
this.configDir = path.join(__dirname, 'user-config.json')
}
this.defaultConfig = {
downloadDir: "./downloads",
fileStructure: "artist/artwork",