@@ -93,33 +93,37 @@ public File doCreateApp() throws Exception {
93
93
94
94
if (this .administratorRequired ) {
95
95
96
+ // We need a helper script ("startup") in this case,
97
+ // which invokes the launcher script/ executable with administrator rights.
98
+ // TODO: admin script depends on launcher file name 'universalJavaApplicationStub'
99
+
96
100
// sets startup file
97
101
this .executable = new File (macOSFolder , "startup" );
98
102
99
103
// creates startup file to boot java app
100
104
VelocityUtils .render ("mac/startup.vtl" , executable , this );
101
- executable .setExecutable (true , false );
102
- Logger .info ("Startup script file created in " + executable .getAbsolutePath ());
103
-
104
105
} else {
105
106
106
- // sets startup file
107
- this .executable = new File (macOSFolder , "universalJavaApplicationStub" );
108
- Logger .info ("Using " + executable .getAbsolutePath () + " as startup script" );
109
-
110
- }
111
-
112
- // copies universalJavaApplicationStub startup file to boot java app
113
- File appStubFile = new File (macOSFolder , "universalJavaApplicationStub" );
114
- String universalJavaApplicationStubResource = null ;
115
- switch (macConfig .getMacStartup ()) {
116
- case UNIVERSAL : universalJavaApplicationStubResource = "universalJavaApplicationStub" ; break ;
117
- case X86_64 : universalJavaApplicationStubResource = "universalJavaApplicationStub.x86_64" ; break ;
118
- case ARM64 : universalJavaApplicationStubResource = "universalJavaApplicationStub.arm64" ; break ;
119
- case SCRIPT : universalJavaApplicationStubResource = "universalJavaApplicationStub.sh" ; break ;
107
+ File launcher = macConfig .getCustomLauncher ();
108
+ if (launcher != null && launcher .canRead () && launcher .isFile ()){
109
+ FileUtils .copyFileToFolder (launcher , macOSFolder );
110
+ this .executable = new File (macOSFolder , launcher .getName ());
111
+ } else {
112
+ // sets startup file
113
+ File appStubFile = new File (macOSFolder , "universalJavaApplicationStub" );
114
+ String universalJavaApplicationStubResource = null ;
115
+ switch (macConfig .getMacStartup ()) {
116
+ case UNIVERSAL : universalJavaApplicationStubResource = "universalJavaApplicationStub" ; break ;
117
+ case X86_64 : universalJavaApplicationStubResource = "universalJavaApplicationStub.x86_64" ; break ;
118
+ case ARM64 : universalJavaApplicationStubResource = "universalJavaApplicationStub.arm64" ; break ;
119
+ case SCRIPT : universalJavaApplicationStubResource = "universalJavaApplicationStub.sh" ; break ;
120
+ }
121
+ FileUtils .copyResourceToFile ("/mac/" + universalJavaApplicationStubResource , appStubFile );
122
+ this .executable = appStubFile ;
123
+ }
120
124
}
121
- FileUtils . copyResourceToFile ( "/mac/" + universalJavaApplicationStubResource , appStubFile );
122
- appStubFile . setExecutable ( true , false );
125
+ executable . setExecutable ( true , false );
126
+ Logger . info ( "Startup script file created in " + executable . getAbsolutePath () );
123
127
124
128
// process classpath
125
129
classpath = (this .macConfig .isRelocateJar () ? "Java/" : "" ) + this .jarFile .getName () + (classpath != null ? ":" + classpath : "" );
0 commit comments