| 6 | import { logger } from "./log"; |
| 7 | |
| 8 | function readCategoryConfig(configCategory: string, callback: (config: any) => boolean) { |
| 9 | const configPaths = StorageSubsystem.readDir(configCategory); |
| 10 | for (const configPath of configPaths) { |
| 11 | try { |
| 12 | const config = JSON.parse(StorageSubsystem.readFile(configPath)); |
| 13 | if (callback(config)) { |
| 14 | logger.info(t("TXT_CODE_6b2a9cab"), configPath); |
| 15 | StorageSubsystem.writeFile(configPath, JSON.stringify(config, null, 4)); |
| 16 | } |
| 17 | } catch (error: any) { |
| 18 | logger.error(t("TXT_CODE_fb75aba9"), error); |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | function refactorUserConfig(config: any) { |
| 24 | let changed = false; |