Merge pull request #664 from wolsen/619-fix-graphics-launcher-osx

Use the open -a prefix to commands on OSX
This commit is contained in:
Daniel Williams 2020-05-12 22:43:12 -04:00 committed by GitHub
commit a1a777266b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,8 @@ import java.text.MessageFormat;
import net.sf.openrocket.appearance.AppearanceBuilder;
import net.sf.openrocket.appearance.DecalImage;
import net.sf.openrocket.arch.SystemInfo;
import net.sf.openrocket.arch.SystemInfo.Platform;
import net.sf.openrocket.document.OpenRocketDocument;
import net.sf.openrocket.gui.dialogs.EditDecalDialog;
import net.sf.openrocket.gui.watcher.FileWatcher;
@ -179,6 +181,15 @@ public class EditDecalHelper {
command = commandTemplate + " " + filename;
}
/* On OSX, the program needs to be opened using the command
* open -a to tell it which application to use to open the
* program. Check to see if the command starts with it or not
* and pre-pend it as necessary. See issue #619.
*/
if (SystemInfo.getPlatform() == Platform.MAC_OS && !command.startsWith("open -a")) {
command = "open -a " + command;
}
try {
Runtime.getRuntime().exec(command);
} catch (IOException ioex) {