Use the open -a prefix to commands on OSX

On the OSX platform, the command editor needs to open the program
with using the 'open' command.

Signed-off-by: Billy Olsen <billy.olsen@gmail.com>
This commit is contained in:
Billy Olsen 2020-05-10 19:23:09 -07:00
parent 3f0a5b1780
commit e0982935e1

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) {