fix: pass bare deck names to Forge sim (not full paths)

Forge's sim mode looks up decks by NAME in its own
%APPDATA%/Forge/decks/commander/ directory. Passing a full path like
D:\...\precon-decks\Counterpunch.dck causes 'Could not load deck'.

Now strips the path and .dck extension so Forge sees just the bare
name (e.g. 'Counterpunch') and finds it in its deck folder.

Precon .dck files must be copied to %APPDATA%/Forge/decks/commander/
for Forge to find them.
This commit is contained in:
KoalaTrapLord committed 2026-04-05 16:47:54 +00:00
1 parent 65873555bc
commit 0b01f1c467
1 file changed
+16 -4
@@ -443,13 +443,25 @@ public class BatchRunner {
cmd.add("sim");
// Pass each deck as a full absolute path so Forge can find the .dck file
// regardless of its working directory.
// Forge's sim mode looks up decks by NAME inside its own
// decks/commander/ directory (%APPDATA%/Forge/decks/commander/).
// It does NOT accept full paths — passing a path like
// D:\...\precon-decks\Counterpunch.dck causes "Could not load deck".
//
// Strip the path and .dck extension so Forge sees just the bare
// name (e.g. "Counterpunch") and finds it in its own folder.
cmd.add("-d");
for (DeckInfo deck : decks) {
String resolvedPath = resolveFullDeckPath(deck.deckFile);
cmd.add(resolvedPath);
System.out.println("[DECK] Resolved deck path: " + resolvedPath);
// Extract just the deck name: "Counterpunch" from full path
String deckName = resolvedPath;
int lastSep = Math.max(deckName.lastIndexOf('/'), deckName.lastIndexOf('\\'));
if (lastSep >= 0) deckName = deckName.substring(lastSep + 1);
if (deckName.toLowerCase().endsWith(".dck")) {
deckName = deckName.substring(0, deckName.length() - 4);
}
cmd.add(deckName);
System.out.println("[DECK] Resolved: " + resolvedPath + " → Forge name: " + deckName);
}
cmd.add("-f");