MAS does not support or allow command-line applications and may run executables with strange arguments for no apparent reason (e.g. filebot.launcher -psn_0_774333) so we ignore arguments completely in this case

This commit is contained in:
Reinhard Pointner 2018-12-17 16:43:02 +07:00
parent 7213220c86
commit 4b3ac80a88
3 changed files with 11 additions and 3 deletions

View File

@ -223,6 +223,9 @@
<option value="-Dapple.laf.useScreenMenuBar=true" />
<option value="-Dfile.encoding=UTF-8" />
<!-- MAS does not support or allow command-line applications and may run executables with strange arguments for no apparent reason (e.g. filebot.launcher -psn_0_774333) so we ignore arguments completely in this case -->
<option value="-Dapple.app.launcher=true" />
<!-- libjfxwebkit.dylib cannot be deployed on the MAS due to deprecated dependencies -->
<option value="-Dapplication.deployment=@{deployment}" />

View File

@ -58,7 +58,7 @@ public class Main {
public static void main(String[] argv) {
try {
// parse arguments
ArgumentBean args = isMacSandbox() ? new ArgumentBean() : new ArgumentBean(argv); // MAS does not support or allow command-line applications and may run executables with strange arguments for no apparent reason (e.g. filebot.launcher -psn_0_774333)
ArgumentBean args = ArgumentBean.parse(argv);
// just print help message or version string and then exit
if (args.printHelp()) {

View File

@ -367,8 +367,8 @@ public class ArgumentBean {
this.args = new String[0];
}
public ArgumentBean(String... args) throws CmdLineException {
this.args = args;
public ArgumentBean(String[] args) throws CmdLineException {
this.args = args.clone();
CmdLineParser parser = new CmdLineParser(this);
parser.parseArgument(args);
@ -393,4 +393,9 @@ public class ArgumentBean {
return () -> new CmdlineException(message + ": " + value);
}
public static ArgumentBean parse(String... args) throws CmdLineException {
// MAS does not support or allow command-line applications and may run executables with strange arguments for no apparent reason (e.g. filebot.launcher -psn_0_774333) so we ignore arguments completely in this case
return Boolean.parseBoolean(System.getProperty("apple.app.launcher")) || args == null ? new ArgumentBean() : new ArgumentBean(args);
}
}