Skip to content

Commit 9f6fc03

Browse files
committed
U refactoring and warns about wrapjar property
1 parent 8eae0cf commit 9f6fc03

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

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

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package io.github.fvarrui.javapackager.packagers;
22

3-
import io.github.fvarrui.javapackager.model.Platform;
4-
import io.github.fvarrui.javapackager.utils.*;
5-
63
import java.io.File;
7-
import java.io.FileOutputStream;
8-
import java.util.Properties;
4+
5+
import io.github.fvarrui.javapackager.model.Platform;
6+
import io.github.fvarrui.javapackager.model.WindowsConfig;
7+
import io.github.fvarrui.javapackager.utils.CommandUtils;
8+
import io.github.fvarrui.javapackager.utils.FileUtils;
9+
import io.github.fvarrui.javapackager.utils.Logger;
10+
import io.github.fvarrui.javapackager.utils.VelocityUtils;
911

1012
/**
1113
* Creates Windows executable with WinRun4j
@@ -35,6 +37,12 @@ protected File doApply(WindowsPackager packager) throws Exception {
3537
File manifestFile = packager.getManifestFile();
3638
File iconFile = packager.getIconFile();
3739
File appFolder = packager.getAppFolder();
40+
File jarFile = packager.getJarFile();
41+
WindowsConfig winConfig = packager.getWinConfig();
42+
43+
if (winConfig.isWrapJar()) {
44+
Logger.warn("'wrapJar' property ignored when building EXE with " + getArtifactName());
45+
}
3846

3947
createAssets(packager);
4048

@@ -57,19 +65,15 @@ protected File doApply(WindowsPackager packager) throws Exception {
5765
Logger.info("INI file generated in " + genericIni.getAbsolutePath() + "!");
5866

5967
// process EXE with rcedit-x64.exe
60-
CommandUtils.execute(rcedit.getAbsolutePath(), getGenericExe(), "--set-icon", getGenericIcon());
61-
CommandUtils.execute(rcedit.getAbsolutePath(), getGenericExe(), "--application-manifest", getGenericManifest());
62-
CommandUtils.execute(rcedit.getAbsolutePath(), getGenericExe(), "--set-version-string", "FileDescription", name);
63-
64-
// generates why properties
65-
/*File propertiesFile = new File(getOutputFolder(), "launcher.ini");
66-
Properties properties = new Properties();
67-
properties.setProperty("mainclass", mainClass);
68-
properties.store(new FileOutputStream(propertiesFile), "Why Java Launcher Properties");*/
68+
CommandUtils.execute(rcedit, getGenericExe(), "--set-icon", getGenericIcon());
69+
CommandUtils.execute(rcedit, getGenericExe(), "--application-manifest", getGenericManifest());
70+
CommandUtils.execute(rcedit, getGenericExe(), "--set-version-string", "FileDescription", name);
6971

72+
// copies JAR to app folder
73+
FileUtils.copyFileToFolder(jarFile, appFolder);
74+
7075
// copies ini file to app folder
71-
File iniFile = new File(appFolder, "launcher.ini");
72-
FileUtils.copyFileToFile(genericIni, iniFile);
76+
FileUtils.copyFileToFolder(genericIni, appFolder);
7377

7478
// signs generated exe file
7579
sign(getGenericExe(), packager);

0 commit comments

Comments
 (0)