}
@Override
protected void jobCompleted() {
try {
AbstractFile parent;
// Mac OS X
if(OsFamily.MAC_OS_X.isCurrent()) {
parent = destJar.getParent();
// Look for an .app container that encloses the JAR file
if(parent.getName().equals("Java")
&&(parent=parent.getParent())!=null && parent.getName().equals("Resources")
&&(parent=parent.getParent())!=null && parent.getName().equals("Contents")
&&(parent=parent.getParent())!=null && "app".equals(parent.getExtension())) {
String appPath = parent.getAbsolutePath();
LOGGER.debug("Opening "+appPath);
// Open -W wait for the current muCommander .app to terminate, before re-opening it
ProcessRunner.execute(new String[]{"/bin/sh", "-c", "open -W "+appPath+" && open "+appPath});
return;
}
}
else {
parent = destJar.getParent();
EqualsFilenameFilter launcherFilter;
// Windows
if(OsFamily.WINDOWS.isCurrent()) {
// Look for a muCommander.exe launcher located in the same folder as the JAR file
launcherFilter = new EqualsFilenameFilter("muCommander.exe", false);
}
// Other platforms, possibly Unix/Linux
else {
// Look for a mucommander.sh located in the same folder as the JAR file
launcherFilter = new EqualsFilenameFilter("mucommander.sh", false);
}
AbstractFile[] launcherFile = parent.ls(launcherFilter);
// If a launcher file was found, execute it
if(launcherFile!=null && launcherFile.length==1) {
DesktopManager.open(launcherFile[0]);