MCPcopy Create free account
hub / github.com/Shazbot/WH3-Mod-Manager / executePackFilesNode

Function executePackFilesNode

src/nodeExecutor.ts:381–434  ·  view source on GitHub ↗
(nodeId: string, textValue: string)

Source from the content-addressed store, hash-verified

379};
380
381async function executePackFilesNode(nodeId: string, textValue: string): Promise<NodeExecutionResult> {
382 console.log(`PackFiles Node ${nodeId}: Processing "${textValue}"`);
383
384 // Parse file paths from text input
385 const filePaths = textValue
386 .split("\n")
387 .filter((line) => line.trim())
388 .map((line) => (line.endsWith(".pack") ? line : `${line}.pack`));
389 const packFiles = [] as PackFilesNodeFile[];
390
391 for (const filePath of filePaths) {
392 let foundMod = appData.enabledMods.find((mod) => mod.name == filePath);
393 if (!foundMod) {
394 foundMod = appData.allMods.find((mod) => mod.name == filePath);
395 }
396
397 try {
398 // Check if file exists
399 if (foundMod) {
400 packFiles.push({
401 name: path.basename(foundMod.path),
402 path: foundMod.path,
403 loaded: true,
404 });
405 } else {
406 console.warn(`PackFiles Node ${nodeId}: File not found: ${filePath}`);
407 packFiles.push({
408 name: filePath,
409 path: filePath,
410 loaded: false,
411 error: "File not found",
412 });
413 }
414 } catch (error) {
415 console.error(`PackFiles Node ${nodeId}: Error processing file ${filePath}:`, error);
416 packFiles.push({
417 name: path.basename(filePath),
418 path: filePath,
419 loaded: false,
420 error: error instanceof Error ? error.message : "Unknown error",
421 });
422 }
423 }
424
425 return {
426 success: true,
427 data: {
428 type: "PackFiles",
429 files: packFiles,
430 count: packFiles.length,
431 loadedCount: packFiles.filter((f) => f.loaded).length,
432 } as PackFilesNodeData,
433 };
434}
435
436async function executePackFilesDropdownNode(
437 nodeId: string,

Callers 1

executeNodeActionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected