From af091f202265e7dcb1f8e32c12030398e6f0d57b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Thu, 16 Jan 2025 10:10:48 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8D=20`config.json`=20?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=9C=AA=E6=89=BE=E5=88=B0=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/src/config/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/core/src/config/index.js b/packages/core/src/config/index.js index 1c8ad34..05679f5 100644 --- a/packages/core/src/config/index.js +++ b/packages/core/src/config/index.js @@ -458,9 +458,14 @@ function _getConfigPath () { // 兼容1.7.3及以下版本的配置文件处理逻辑 const newFilePath = path.join(dir, '/config.json') const oldFilePath = path.join(dir, '/config.json5') - if (!fs.existsSync(newFilePath) && fs.existsSync(oldFilePath)) { - return oldFilePath // 如果新文件不存在,且旧文件存在,则返回旧文件路径 + if (!fs.existsSync(newFilePath)) { + if (fs.existsSync(oldFilePath)) { + return oldFilePath // 如果新文件不存在,且旧文件存在,则返回旧文件路径 + } else { + return null // 两个文件都不存在 + } } + return newFilePath }