Skip to content

Commit c77cfeb

Browse files
committed
Support configured package names in command-line pack action
1 parent b76c6ad commit c77cfeb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/sporemodder/Launcher.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import sporemodder.file.simulator.SimulatorClass;
2727
import sporemodder.file.spui.SporeUserInterface;
2828
import sporemodder.util.NameRegistry;
29+
import sporemodder.util.Project;
2930

3031
public class Launcher {
3132

@@ -369,7 +370,7 @@ public static class PackCommand implements Callable<Integer> {
369370
@Parameters(index = "0", description = "The input folder to pack.")
370371
private File input;
371372

372-
@Parameters(index = "1", description = "The output DBPF file to generate.")
373+
@Parameters(index = "1", description = "The output DBPF file to generate. If the output is a folder, the input must be a project, and the output DBPF name will be taken from the project settings.")
373374
private File output;
374375

375376
@Option(names = {"--compress"}, description = "[Experimental] Compress files bigger than N bytes")
@@ -379,6 +380,12 @@ public static class PackCommand implements Callable<Integer> {
379380
public Integer call() throws Exception {
380381
input = input.getAbsoluteFile();
381382
output = output.getAbsoluteFile();
383+
384+
if (output.isDirectory()) {
385+
Project project = new Project(input.getName(), input, null);
386+
project.loadSettings();
387+
output = new File(output, project.getPackageName());
388+
}
382389

383390
startTime = System.currentTimeMillis();
384391
final DBPFPackingTask task = new DBPFPackingTask(input, output);

0 commit comments

Comments
 (0)