Skip to content

Commit fdca8ec

Browse files
committed
U if macos startup is a script then 'unixStyleNewLinux=true', replacing '\r\n' with '\n'
1 parent fe6690c commit fdca8ec

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/io/github/fvarrui/javapackager/packagers/MacPackager.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.apache.commons.lang3.StringUtils;
1010
import org.apache.commons.lang3.SystemUtils;
1111

12+
import io.github.fvarrui.javapackager.model.MacStartup;
1213
import io.github.fvarrui.javapackager.model.Platform;
1314
import io.github.fvarrui.javapackager.utils.CommandUtils;
1415
import io.github.fvarrui.javapackager.utils.FileUtils;
@@ -105,6 +106,7 @@ public File doCreateApp() throws Exception {
105106
}
106107

107108
private void processStartupScript() throws Exception {
109+
108110
if (this.administratorRequired) {
109111

110112
// We need a helper script ("startup") in this case,
@@ -116,6 +118,7 @@ private void processStartupScript() throws Exception {
116118

117119
// creates startup file to boot java app
118120
VelocityUtils.render("mac/startup.vtl", executable, this);
121+
119122
} else {
120123

121124
File launcher = macConfig.getCustomLauncher();
@@ -126,6 +129,7 @@ private void processStartupScript() throws Exception {
126129
this.executable = preparePrecompiledStartupStub();
127130
}
128131
}
132+
129133
executable.setExecutable(true, false);
130134
Logger.info("Startup script file created in " + executable.getAbsolutePath());
131135
}
@@ -189,7 +193,8 @@ private File preparePrecompiledStartupStub() throws Exception {
189193
case ARM64: universalJavaApplicationStubResource = "universalJavaApplicationStub.arm64"; break;
190194
case SCRIPT: universalJavaApplicationStubResource = "universalJavaApplicationStub.sh"; break;
191195
}
192-
FileUtils.copyResourceToFile("/mac/" + universalJavaApplicationStubResource, appStubFile);
196+
// unixStyleNewLinux=true if startup is a script (this will replace '\r\n' with '\n')
197+
FileUtils.copyResourceToFile("/mac/" + universalJavaApplicationStubResource, appStubFile, macConfig.getMacStartup() == MacStartup.SCRIPT);
193198
return appStubFile;
194199
}
195200

0 commit comments

Comments
 (0)