From 17cc3db33d247adf1250f1e982091646ce4cc13c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Fri, 24 Jan 2025 14:24:32 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20config.json=20=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=9C=B0=E5=9D=80=E4=B8=BA=E7=A9=BA=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/config/local-config-loader.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/core/src/config/local-config-loader.js b/packages/core/src/config/local-config-loader.js index 994ad09..699bbaf 100644 --- a/packages/core/src/config/local-config-loader.js +++ b/packages/core/src/config/local-config-loader.js @@ -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