···1818 public ProjectListing(File path, long lastOpened) throws IOException, KdlParseException
1919 {
2020 if (!path.isDirectory())
2121- throw new IllegalArgumentException("Project path must be a directory: " + path);
2121+ throw new IOException("Project path is not a directory: " + path.getAbsolutePath());
2222 this.directory = path.getAbsoluteFile();
2323 this.lastOpened = lastOpened;
2424 this.manifest = new Manifest(this.directory);
+16-7
src/main/java/project/engine/Engine.java
···66import app.Environment;
77import project.Project;
88import util.Logger;
99+import util.Priority;
9101011/**
1112 * A checkout of papermario-dx that has been built, ready for modding.
···4546 else
4647 checkoutRef();
4748 }
4848- }
49495050- // --- Factory ---
5050+ splitAssets(); // TODO: only call when necessary i.e. git HEAD changed
5151+ }
51525253 /**
5354 * Resolves and sets up the engine for a project.
···6667 // Worktree-based engine
6768 File engineBase = buildEnv.getEngineBaseDir();
68696969- String projectId = project.getManifest().getId();
7070- if (projectId == null || projectId.isEmpty())
7171- projectId = project.getDirectory().getName();
7272- File worktreeDir = new File(engineBase, "worktrees/" + projectId);
7070+ // Use ref as directory name so projects with the same ref share the worktree
7171+ // Prefix with wt- to prevent collision between foo and foo/bar
7272+ File worktreeDir = new File(engineBase, "worktrees/wt-" + ref);
73737474 return new Engine(worktreeDir, ref, false, buildEnv);
7575 }
···118118119119 private void cloneBareRepo() throws IOException
120120 {
121121+ Logger.log("Downloading engine...", Priority.MILESTONE);
121122 buildEnv.gitCloneBare(REPO_URL, getBareRepoDir(), BuildOutputListener.toLogger());
122123 }
123124124125 private void createWorktree() throws IOException
125126 {
127127+ Logger.log("Setting up engine ref '" + ref + "'...", Priority.MILESTONE);
128128+129129+ // Ensure parent directories exist (needed for refs like foo/bar)
130130+ File parent = directory.getParentFile();
131131+ if (parent != null && !parent.exists())
132132+ parent.mkdirs();
133133+126134 buildEnv.gitWorktreeAdd(getBareRepoDir(), directory, ref, BuildOutputListener.toLogger());
127135 }
128136129137 private void checkoutRef() throws IOException
130138 {
139139+ Logger.log("Updating engine...", Priority.MILESTONE);
131140 buildEnv.gitFetchAll(getBareRepoDir(), BuildOutputListener.toLogger());
132141 buildEnv.gitCheckout(directory, ref, BuildOutputListener.toLogger());
133142 }
134143135135- // TODO: call this somewhere!
136144 public BuildResult splitAssets() throws BuildException, IOException
137145 {
146146+ Logger.log("Splitting assets from ROM...", Priority.MILESTONE);
138147 return buildEnv.configure(directory, BuildOutputListener.toLogger());
139148 }
140149