this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix Engine setup

+34 -71
+1 -9
src/main/java/app/Environment.java
··· 219 219 } 220 220 } 221 221 else { 222 - try { 223 - Properties prop = new Properties(); 224 - prop.load(new FileInputStream(new File("./app.properties"))); 225 - versionString = prop.getProperty("version"); 226 - Logger.logf("Detected version %s (IDE)", versionString); 227 - } 228 - catch (IOException e) { 229 - Logger.logError("Could not read version properties file: " + e.getMessage()); 230 - } 222 + versionString = "dev"; 231 223 } 232 224 233 225 // Create user directories
+1 -1
src/main/java/project/ProjectListing.java
··· 18 18 public ProjectListing(File path, long lastOpened) throws IOException, KdlParseException 19 19 { 20 20 if (!path.isDirectory()) 21 - throw new IllegalArgumentException("Project path must be a directory: " + path); 21 + throw new IOException("Project path is not a directory: " + path.getAbsolutePath()); 22 22 this.directory = path.getAbsoluteFile(); 23 23 this.lastOpened = lastOpened; 24 24 this.manifest = new Manifest(this.directory);
+16 -7
src/main/java/project/engine/Engine.java
··· 6 6 import app.Environment; 7 7 import project.Project; 8 8 import util.Logger; 9 + import util.Priority; 9 10 10 11 /** 11 12 * A checkout of papermario-dx that has been built, ready for modding. ··· 45 46 else 46 47 checkoutRef(); 47 48 } 48 - } 49 49 50 - // --- Factory --- 50 + splitAssets(); // TODO: only call when necessary i.e. git HEAD changed 51 + } 51 52 52 53 /** 53 54 * Resolves and sets up the engine for a project. ··· 66 67 // Worktree-based engine 67 68 File engineBase = buildEnv.getEngineBaseDir(); 68 69 69 - String projectId = project.getManifest().getId(); 70 - if (projectId == null || projectId.isEmpty()) 71 - projectId = project.getDirectory().getName(); 72 - File worktreeDir = new File(engineBase, "worktrees/" + projectId); 70 + // Use ref as directory name so projects with the same ref share the worktree 71 + // Prefix with wt- to prevent collision between foo and foo/bar 72 + File worktreeDir = new File(engineBase, "worktrees/wt-" + ref); 73 73 74 74 return new Engine(worktreeDir, ref, false, buildEnv); 75 75 } ··· 118 118 119 119 private void cloneBareRepo() throws IOException 120 120 { 121 + Logger.log("Downloading engine...", Priority.MILESTONE); 121 122 buildEnv.gitCloneBare(REPO_URL, getBareRepoDir(), BuildOutputListener.toLogger()); 122 123 } 123 124 124 125 private void createWorktree() throws IOException 125 126 { 127 + Logger.log("Setting up engine ref '" + ref + "'...", Priority.MILESTONE); 128 + 129 + // Ensure parent directories exist (needed for refs like foo/bar) 130 + File parent = directory.getParentFile(); 131 + if (parent != null && !parent.exists()) 132 + parent.mkdirs(); 133 + 126 134 buildEnv.gitWorktreeAdd(getBareRepoDir(), directory, ref, BuildOutputListener.toLogger()); 127 135 } 128 136 129 137 private void checkoutRef() throws IOException 130 138 { 139 + Logger.log("Updating engine...", Priority.MILESTONE); 131 140 buildEnv.gitFetchAll(getBareRepoDir(), BuildOutputListener.toLogger()); 132 141 buildEnv.gitCheckout(directory, ref, BuildOutputListener.toLogger()); 133 142 } 134 143 135 - // TODO: call this somewhere! 136 144 public BuildResult splitAssets() throws BuildException, IOException 137 145 { 146 + Logger.log("Splitting assets from ROM...", Priority.MILESTONE); 138 147 return buildEnv.configure(directory, BuildOutputListener.toLogger()); 139 148 } 140 149
+16 -54
src/main/java/project/ui/ProjectSwitcherDialog.java
··· 430 430 return; 431 431 } 432 432 433 - int choice = SwingUtils.getConfirmDialog() 434 - .setTitle("Remove project") 435 - .setMessage("Remove \"" + selected.getName() + "\" from the project list?", 436 - "The project files will not be deleted.") 437 - .setOptionsType(JOptionPane.YES_NO_OPTION) 438 - .choose(); 439 - 440 - if (choice == JOptionPane.YES_OPTION) { 441 - projectManager.removeFromHistory(selected); 442 - refreshProjectList(); 443 - updateListFilter(); 433 + projectManager.removeFromHistory(selected); 434 + refreshProjectList(); 435 + updateListFilter(); 444 436 445 - if (filteredListModel.getSize() > 0) { 446 - list.setSelectedIndex(0); 447 - } 437 + if (filteredListModel.getSize() > 0) { 438 + list.setSelectedIndex(0); 448 439 } 449 440 } 450 441 ··· 455 446 return; 456 447 } 457 448 458 - // Show confirmation dialog with checkbox 459 - JCheckBox confirmCheck = new JCheckBox("I understand this cannot be undone"); 460 - confirmCheck.setSelected(false); 461 - 462 - Object[] message = { 463 - "WARNING: This will permanently delete all files in:", 464 - selected.getPath(), 465 - "", 466 - confirmCheck 467 - }; 468 - 469 - int choice = JOptionPane.showConfirmDialog( 470 - this, 471 - message, 472 - "Delete Project from Disk", 473 - JOptionPane.OK_CANCEL_OPTION, 474 - JOptionPane.WARNING_MESSAGE 475 - ); 449 + boolean success = projectManager.deleteFromDisk(selected); 450 + if (!success) { 451 + SwingUtils.getErrorDialog() 452 + .setTitle("Delete Failed") 453 + .setMessage("Failed to delete project files.") 454 + .show(); 455 + } 476 456 477 - if (choice == JOptionPane.OK_OPTION && confirmCheck.isSelected()) { 478 - boolean success = projectManager.deleteFromDisk(selected); 479 - if (!success) { 480 - SwingUtils.getErrorDialog() 481 - .setTitle("Delete Failed") 482 - .setMessage("Failed to delete project files.", 483 - "The project has been removed from the list.", 484 - "You may need to delete the files manually.") 485 - .show(); 486 - } 457 + refreshProjectList(); 458 + updateListFilter(); 487 459 488 - refreshProjectList(); 489 - updateListFilter(); 490 - 491 - if (filteredListModel.getSize() > 0) { 492 - list.setSelectedIndex(0); 493 - } 494 - } 495 - else if (choice == JOptionPane.OK_OPTION && !confirmCheck.isSelected()) { 496 - SwingUtils.getWarningDialog() 497 - .setTitle("Delete Cancelled") 498 - .setMessage("You must check the confirmation box to delete.") 499 - .show(); 460 + if (filteredListModel.getSize() > 0) { 461 + list.setSelectedIndex(0); 500 462 } 501 463 } 502 464 }