MCPcopy Create free account
hub / github.com/FlashpointProject/launcher / readOrCreateFile

Function readOrCreateFile

src/back/ExtConfigFile.ts:15–31  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

13 }
14
15 export async function readOrCreateFile(filePath: string): Promise<AppExtConfigData> {
16 let error: Error | undefined;
17 let data: any;
18
19 try {
20 data = await readFile(filePath);
21 } catch (e: any) {
22 error = e;
23 }
24
25 if (error || !data) {
26 data = {};
27 saveFile(filePath, data).catch(() => console.log('Failed to save default ext config file!'));
28 }
29
30 return data;
31 }
32
33 export function saveFile(filePath: string, data: AppExtConfigData): Promise<void> {
34 return new Promise((resolve, reject) => {

Callers

nothing calls this directly

Calls 2

readFileFunction · 0.70
saveFileFunction · 0.70

Tested by

no test coverage detected