bugfix: config.json 配置文件地址为空的问题修复。

pull/445/head
王良 2025-01-24 14:24:32 +08:00
parent 60bb317927
commit 17cc3db33d
1 changed files with 2 additions and 6 deletions

View File

@ -59,12 +59,8 @@ function getUserConfigPath () {
// 兼容1.7.3及以下版本的配置文件处理逻辑
const newFilePath = path.join(dir, '/config.json')
const oldFilePath = path.join(dir, '/config.json5')
if (!fs.existsSync(newFilePath)) {
if (fs.existsSync(oldFilePath)) {
return oldFilePath // 如果新文件不存在,但旧文件存在,则返回旧文件路径
} else {
return null // 两个文件都不存在
}
if (!fs.existsSync(newFilePath) && fs.existsSync(oldFilePath)) {
return oldFilePath // 如果新文件不存在,但旧文件存在,则返回旧文件路径
}
return newFilePath