Skip to content

Commit afc967f

Browse files
author
Andy Herrick
committed
8254783: jpackage fails on Windows when application name differs from installer name
Reviewed-by: asemenyuk, kizune, almatvee
1 parent 3ccf487 commit afc967f

File tree

1 file changed

+8
-1
lines changed
  • src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal

1 file changed

+8
-1
lines changed

src/jdk.incubator.jpackage/windows/classes/jdk/incubator/jpackage/internal/WinMsiBundler.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -306,15 +306,22 @@ private void prepareProto(Map<String, ? super Object> params)
306306
throws PackagerException, IOException {
307307
Path appImage = StandardBundlerParam.getPredefinedAppImage(params);
308308
Path appDir;
309+
String appName;
309310

310311
// we either have an application image or need to build one
311312
if (appImage != null) {
312313
appDir = MSI_IMAGE_DIR.fetchFrom(params).resolve(APP_NAME.fetchFrom(params));
313314
// copy everything from appImage dir into appDir/name
314315
IOUtils.copyRecursive(appImage, appDir);
316+
try {
317+
appName = AppImageFile.load(appDir).getLauncherName();
318+
} catch (Exception e) {
319+
appName = APP_NAME.fetchFrom(params);
320+
}
315321
} else {
316322
appDir = appImageBundler.execute(params, MSI_IMAGE_DIR.fetchFrom(
317323
params));
324+
appName = APP_NAME.fetchFrom(params);
318325
}
319326

320327
// Configure installer icon
@@ -331,7 +338,7 @@ private void prepareProto(Map<String, ? super Object> params)
331338
installerIcon = ApplicationLayout.windowsAppImage()
332339
.resolveAt(appDir)
333340
.launchersDirectory()
334-
.resolve(APP_NAME.fetchFrom(params) + ".exe");
341+
.resolve(appName + ".exe");
335342
}
336343
installerIcon = installerIcon.toAbsolutePath();
337344

0 commit comments

Comments
 (0)