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

Function loadCurationFolder

src/back/curate/util.ts:254–284  ·  view source on GitHub ↗
(rootPath: string, folderName: string, state: BackState)

Source from the content-addressed store, hash-verified

252 }
253
254export async function loadCurationFolder(rootPath: string, folderName: string, state: BackState) {
255 const parsedMeta = await readCurationMeta(path.join(rootPath, folderName), state.platformAppPaths);
256 if (parsedMeta) {
257 const loadedCuration: LoadedCuration = {
258 folder: folderName,
259 uuid: parsedMeta.uuid || uuid(),
260 group: parsedMeta.group,
261 game: parsedMeta.game,
262 addApps: parsedMeta.addApps,
263 fpfssInfo: null,
264 thumbnail: await loadCurationIndexImage(path.join(rootPath, folderName, 'logo.png')),
265 screenshot: await loadCurationIndexImage(path.join(rootPath, folderName, 'ss.png'))
266 };
267 const alreadyImported = (await fpDatabase.findGame(loadedCuration.uuid)) !== null;
268 const curation: CurationState = {
269 ...loadedCuration,
270 alreadyImported,
271 warnings: await genCurationWarnings(loadedCuration, state.config.flashpointPath, state.suggestions, state.languageContainer.curate, state.apiEmitters.curations.onWillGenCurationWarnings)
272 };
273 // Try and load fpfss data
274 curation.fpfssInfo = await getCurationFpfssInfo(path.join(rootPath, folderName));
275 state.loadedCurations.push(curation);
276 genContentTree(getContentFolderByKey(folderName, state.config.flashpointPath)).then((contentTree) => {
277 const curationIdx = state.loadedCurations.findIndex((c) => c.folder === folderName);
278 if (curationIdx >= 0) {
279 state.loadedCurations[curationIdx].contents = contentTree;
280 state.socketServer.broadcast(BackOut.CURATE_CONTENTS_CHANGE, folderName, contentTree);
281 }
282 });
283 }
284}
285
286// Duplicates and then loads a curation
287export async function duplicateCuration(srcFolder: string, state: BackState): Promise<string> {

Callers 3

initializeFunction · 0.90
registerRequestCallbacksFunction · 0.90
duplicateCurationFunction · 0.85

Calls 9

readCurationMetaFunction · 0.90
uuidFunction · 0.90
loadCurationIndexImageFunction · 0.90
getCurationFpfssInfoFunction · 0.90
genContentTreeFunction · 0.90
getContentFolderByKeyFunction · 0.90
genCurationWarningsFunction · 0.85
broadcastMethod · 0.80
pushMethod · 0.65

Tested by

no test coverage detected