Skip to content

Commit 0cc7f35

Browse files
author
Andy Herrick
committedMay 13, 2020
8244576: [macos] Volume icon deleted by osascript for background image
Reviewed-by: asemenyuk, almatvee
1 parent 9768618 commit 0cc7f35

File tree

1 file changed

+16
-17
lines changed
  • src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal

1 file changed

+16
-17
lines changed
 

‎src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacDmgBundler.java

+16-17
Original file line numberDiff line numberDiff line change
@@ -310,19 +310,29 @@ private File buildDMG(
310310

311311
File mountedRoot = new File(imagesRoot.getAbsolutePath(),
312312
APP_NAME.fetchFrom(params));
313-
314313
try {
315-
// volume icon
316-
File volumeIconFile = new File(mountedRoot, ".VolumeIcon.icns");
317-
IOUtils.copyFile(getConfig_VolumeIcon(params),
318-
volumeIconFile);
319-
320314
// background image
321315
File bgdir = new File(mountedRoot, BACKGROUND_IMAGE_FOLDER);
322316
bgdir.mkdirs();
323317
IOUtils.copyFile(getConfig_VolumeBackground(params),
324318
new File(bgdir, BACKGROUND_IMAGE));
325319

320+
// We will not consider setting background image and creating link
321+
// to install-dir in DMG as critical error, since it can fail in
322+
// headless enviroment.
323+
try {
324+
pb = new ProcessBuilder("osascript",
325+
getConfig_VolumeScript(params).getAbsolutePath());
326+
IOUtils.exec(pb);
327+
} catch (IOException ex) {
328+
Log.verbose(ex);
329+
}
330+
331+
// volume icon
332+
File volumeIconFile = new File(mountedRoot, ".VolumeIcon.icns");
333+
IOUtils.copyFile(getConfig_VolumeIcon(params),
334+
volumeIconFile);
335+
326336
// Indicate that we want a custom icon
327337
// NB: attributes of the root directory are ignored
328338
// when creating the volume
@@ -356,16 +366,6 @@ private File buildDMG(
356366
Log.verbose(I18N.getString("message.setfile.dmg"));
357367
}
358368

359-
// We will not consider setting background image and creating link to
360-
// /Application folder in DMG as critical error, since it can fail in
361-
// headless enviroment.
362-
try {
363-
pb = new ProcessBuilder("osascript",
364-
getConfig_VolumeScript(params).getAbsolutePath());
365-
IOUtils.exec(pb);
366-
} catch (IOException ex) {
367-
Log.verbose(ex);
368-
}
369369
} finally {
370370
// Detach the temporary image
371371
pb = new ProcessBuilder(
@@ -493,5 +493,4 @@ public static boolean isSupported() {
493493
public boolean isDefault() {
494494
return true;
495495
}
496-
497496
}

0 commit comments

Comments
 (0)
Please sign in to comment.