9
9
10
10
import org .apache .commons .lang3 .StringUtils ;
11
11
12
+ import io .github .fvarrui .javapackager .model .Arch ;
12
13
import io .github .fvarrui .javapackager .model .Platform ;
13
14
import io .github .fvarrui .javapackager .model .WindowsConfig ;
14
15
import io .github .fvarrui .javapackager .model .WindowsExeCreationTool ;
@@ -57,7 +58,8 @@ protected File doApply(WindowsPackager packager) throws Exception {
57
58
File jreDestinationFolder = packager .getJreDestinationFolder ();
58
59
boolean bundleJre = packager .getBundleJre ();
59
60
String vmLocation = packager .getWinConfig ().getVmLocation ();
60
- WindowsConfig winConfig = packager .getWinConfig ();
61
+ WindowsConfig winConfig = packager .getWinConfig ();
62
+ Arch arch = packager .getArch ();
61
63
62
64
if (winConfig .isWrapJar ()) {
63
65
Logger .warn ("'wrapJar' property ignored when building EXE with " + getArtifactName ());
@@ -72,7 +74,11 @@ protected File doApply(WindowsPackager packager) throws Exception {
72
74
FileUtils .copyFileToFile (iconFile , getGenericIcon ());
73
75
74
76
// creates generic exe
75
- FileUtils .copyResourceToFile ("/windows/WinRun4J64.exe" , getGenericExe ());
77
+ if (arch == Arch .x64 ) {
78
+ FileUtils .copyResourceToFile ("/windows/WinRun4J64.exe" , getGenericExe ());
79
+ } else if (arch == Arch .x86 ) {
80
+ FileUtils .copyResourceToFile ("/windows/WinRun4J.exe" , getGenericExe ());
81
+ }
76
82
77
83
// uses vmLocation only if a JRE is bundled
78
84
if (bundleJre ) {
@@ -89,7 +95,7 @@ protected File doApply(WindowsPackager packager) throws Exception {
89
95
90
96
} else {
91
97
92
- // searchs for valid jvm.dll file in JRE
98
+ // searchs for a valid jvm.dll file in JRE
93
99
Optional <File > jvmDllFile = Arrays .asList (JVM_DLL_PATHS )
94
100
.stream ()
95
101
.map (path -> new File (jreDestinationFolder , path ))
@@ -115,11 +121,6 @@ protected File doApply(WindowsPackager packager) throws Exception {
115
121
116
122
}
117
123
118
- // generates ini file
119
- File genericIni = new File (getOutputFolder (), "app.ini" );
120
- VelocityUtils .render ("windows/ini.vtl" , genericIni , packager );
121
- Logger .info ("INI file generated in " + genericIni .getAbsolutePath () + "!" );
122
-
123
124
// set exe metadata with rcedit
124
125
RcEdit rcedit = new RcEdit (getOutputFolder ());
125
126
rcedit .setIcon (getGenericExe (), getGenericIcon ());
@@ -136,6 +137,7 @@ protected File doApply(WindowsPackager packager) throws Exception {
136
137
FileUtils .copyFileToFolder (jarFile , appFolder );
137
138
138
139
// copies winrun4j launcher helper library (needed to work around
140
+ /*
139
141
File winrun4jJar = new File(libsFolder, "winrun4j-launcher.jar");
140
142
FileUtils.copyResourceToFile("/windows/winrun4j-launcher.jar", winrun4jJar);
141
143
@@ -147,7 +149,13 @@ protected File doApply(WindowsPackager packager) throws Exception {
147
149
148
150
// copies winrun4j properties to launcher jar
149
151
JarUtils.addFileToJar(winrun4jJar, propertiesFile);
152
+ */
150
153
154
+ // generates ini file
155
+ File genericIni = new File (getOutputFolder (), "app.ini" );
156
+ VelocityUtils .render ("windows/ini.vtl" , genericIni , packager );
157
+ Logger .info ("INI file generated in " + genericIni .getAbsolutePath () + "!" );
158
+
151
159
// copies ini file to app folder
152
160
File iniFile = new File (appFolder , name + ".ini" );
153
161
FileUtils .copyFileToFile (genericIni , iniFile );
0 commit comments