Skip to content

Commit

Permalink
Recognize launchers inside macOS app bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrueden committed Feb 24, 2025
1 parent 12b006c commit 65febd1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/java/net/imagej/updater/util/UpdaterUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,23 @@ public static String prettyPrintTimestamp(final long timestamp) {
}

public boolean isLauncher(final String filename) {
int slash = filename.indexOf("/");
if (slash >= 0 && filename.substring(0, slash).endsWith(".app")) {
// This file appears to reside inside a macOS-style .app folder.
// In this case, instead of matching against the full file path relative
// to the application base directory, let's match against the file path
// relative to the app folder. For example, for the file path:
//
// Fiji.app/Contents/MacOS/fiji-macos
//
// we'll instead try to match against:
//
// Contents/MacOS/fiji-macos
//
// So that regardless of the app directory name, the
// Updater still recognizes the file as a launcher.
return isLauncher(filename.substring(slash + 1));
}
return Arrays.binarySearch(launchers, filename) >= 0;
}

Expand Down

0 comments on commit 65febd1

Please sign in to comment.