in src/main/java/org/apache/netbeans/nbpackage/innosetup/InnoSetupTask.java [164:210]
private void createInnoSetupScript(Path image, String execName) throws IOException {
// make sure loaded template has correct line endings
String template = ISS_TEMPLATE.load(context()).lines()
.collect(Collectors.joining("\r\n", "", "\r\n"));
List<Path> files;
try (var l = Files.list(image.resolve(execName))) {
files = l.sorted().collect(Collectors.toList());
}
String installDeleteSection = buildInstallDeleteSection(files);
String filesSection = buildFilesSection(execName, files);
String appName = context().getValue(NBPackage.PACKAGE_NAME).orElse(execName);
String appNameSafe = sanitize(appName);
String appID = context().getValue(APPID).orElse(appName);
String appVersion = context().getValue(NBPackage.PACKAGE_VERSION).orElse("1.0");
String appLicense;
if (Files.exists(image.resolve("license.txt"))) {
appLicense = "LicenseFile=license.txt";
} else if (Files.exists(image.resolve("license.rtf"))) {
appLicense = "LicenseFile=license.rtf";
} else {
appLicense = "";
}
String execParam = context().getValue(NBPackage.PACKAGE_RUNTIME)
.map(p -> "Parameters: \"--jdkhome \"\"{app}\\jdk\"\"\";")
.orElse("");
var map = Map.of("APP_ID", appID,
"APP_NAME", appName,
"APP_NAME_SAFE", appNameSafe,
"APP_VERSION", appVersion,
"APP_LICENSE", appLicense,
"INSTALL_DELETE", installDeleteSection,
"FILES", filesSection,
"EXEC_NAME", execName,
"PARAMETERS", execParam
);
String script = StringUtils.replaceTokens(template, map);
Files.writeString(image.resolve(execName + ".iss"), script,
StandardOpenOption.CREATE_NEW);
}