MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / readCategoryConfig

Function readCategoryConfig

panel/src/app/service/version_adapter.ts:8–21  ·  view source on GitHub ↗
(configCategory: string, callback: (config: any) => boolean)

Source from the content-addressed store, hash-verified

6import { logger } from "./log";
7
8function 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
23function refactorUserConfig(config: any) {
24 let changed = false;

Callers 1

detectConfigFunction · 0.70

Calls 5

readDirMethod · 0.80
infoMethod · 0.80
errorMethod · 0.80
readFileMethod · 0.45
writeFileMethod · 0.45

Tested by

no test coverage detected