From bfd9b1b7c748d5897335c5aff4115fbc4a0ff4c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Mon, 12 Aug 2024 00:34:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E5=BC=82=E5=B8=B8=E6=9C=AA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/utils/ConfigBase.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/common/utils/ConfigBase.ts b/src/common/utils/ConfigBase.ts index a20bcf8ea..5e0444560 100644 --- a/src/common/utils/ConfigBase.ts +++ b/src/common/utils/ConfigBase.ts @@ -4,7 +4,6 @@ import type { NapCatCore } from '@/core'; export abstract class ConfigBase { abstract name: string; - pathName: string | null = null; // 本次读取的文件路径 coreContext: NapCatCore; configPath: string; configData: T = {} as T; @@ -31,7 +30,6 @@ export abstract class ConfigBase { const logger = this.coreContext.context.logger; const configPath = this.getConfigPath(this.coreContext.selfInfo.uin); if (!fs.existsSync(configPath)) { - this.pathName = configPath; // 记录有效的设置文件 try { fs.writeFileSync(configPath, fs.readFileSync(this.getConfigPath(undefined), 'utf-8')); logger.log(`配置文件${configPath}创建成功!\n`); From 0c6a75b7226be48d1336a2ddf67d012825a93d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Mon, 12 Aug 2024 00:35:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/utils/ConfigBase.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/utils/ConfigBase.ts b/src/common/utils/ConfigBase.ts index 5e0444560..18d59ef58 100644 --- a/src/common/utils/ConfigBase.ts +++ b/src/common/utils/ConfigBase.ts @@ -32,20 +32,20 @@ export abstract class ConfigBase { if (!fs.existsSync(configPath)) { try { fs.writeFileSync(configPath, fs.readFileSync(this.getConfigPath(undefined), 'utf-8')); - logger.log(`配置文件${configPath}创建成功!\n`); + logger.log(`[Core] [Config] 配置文件创建成功!\n`); } catch (e: any) { - logger.logError(`创建配置文件 ${configPath} 时发生错误:`, e.message); + logger.logError(`[Core] [Config] 创建配置文件时发生错误:`, e.message); } } try { this.configData = JSON.parse(fs.readFileSync(configPath, 'utf-8')); - logger.logDebug(`配置文件${configPath}已加载`, this.configData); + logger.logDebug(`[Core] [Config] 配置文件${configPath}加载`, this.configData); return this.configData; } catch (e: any) { if (e instanceof SyntaxError) { - logger.logError(`配置文件 ${configPath} 格式错误,请检查配置文件:`, e.message); + logger.logError(`[Core] [Config] 配置文件格式错误,请检查配置文件:`, e.message); } else { - logger.logError(`读取配置文件 ${configPath} 时发生错误:`, e.message); + logger.logError(`[Core] [Config] 读取配置文件时发生错误:`, e.message); } return {} as T; }