Skip to content

Commit

Permalink
Support configured package names in command-line pack action
Browse files Browse the repository at this point in the history
  • Loading branch information
emd4600 committed Sep 29, 2024
1 parent b76c6ad commit c77cfeb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/sporemodder/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import sporemodder.file.simulator.SimulatorClass;
import sporemodder.file.spui.SporeUserInterface;
import sporemodder.util.NameRegistry;
import sporemodder.util.Project;

public class Launcher {

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

@Parameters(index = "1", description = "The output DBPF file to generate.")
@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.")
private File output;

@Option(names = {"--compress"}, description = "[Experimental] Compress files bigger than N bytes")
Expand All @@ -379,6 +380,12 @@ public static class PackCommand implements Callable<Integer> {
public Integer call() throws Exception {
input = input.getAbsoluteFile();
output = output.getAbsoluteFile();

if (output.isDirectory()) {
Project project = new Project(input.getName(), input, null);
project.loadSettings();
output = new File(output, project.getPackageName());
}

startTime = System.currentTimeMillis();
final DBPFPackingTask task = new DBPFPackingTask(input, output);
Expand Down

0 comments on commit c77cfeb

Please sign in to comment.