()
| 137 | |
| 138 | static async init() { |
| 139 | if (this.db) return; |
| 140 | const dbPath = path.join(createDirectoryInAssets(PLUGIN_NAME), CONFIG_FILE); |
| 141 | this.db = await JSONFilePreset<Config>(dbPath, DEFAULT_CONFIG); |
| 142 | // 迁移与标准化 |
| 143 | this.normalize(); |
| 144 | } |
| 145 | |
| 146 | static async getConfig(): Promise<Config> { |
| 147 | await this.init(); |
| 148 | // 再次保证标准化(防止外部意外写入) |
no test coverage detected