changeset 59287:8394b797dc6a

8244576: [macos] Volume icon deleted by osascript for background image Reviewed-by: asemenyuk, almatvee
author herrick
date Wed, 13 May 2020 16:05:02 -0400
parents 4db004a125fa
children c86677114b24
files src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacDmgBundler.java
diffstat 1 files changed, 16 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacDmgBundler.java	Thu May 14 05:35:06 2020 -0700
+++ b/src/jdk.incubator.jpackage/macosx/classes/jdk/incubator/jpackage/internal/MacDmgBundler.java	Wed May 13 16:05:02 2020 -0400
@@ -310,19 +310,29 @@
 
         File mountedRoot = new File(imagesRoot.getAbsolutePath(),
                     APP_NAME.fetchFrom(params));
-
         try {
-            // volume icon
-            File volumeIconFile = new File(mountedRoot, ".VolumeIcon.icns");
-            IOUtils.copyFile(getConfig_VolumeIcon(params),
-                    volumeIconFile);
-
             // background image
             File bgdir = new File(mountedRoot, BACKGROUND_IMAGE_FOLDER);
             bgdir.mkdirs();
             IOUtils.copyFile(getConfig_VolumeBackground(params),
                     new File(bgdir, BACKGROUND_IMAGE));
 
+            // We will not consider setting background image and creating link
+            // to install-dir in DMG as critical error, since it can fail in
+            // headless enviroment.
+            try {
+                pb = new ProcessBuilder("osascript",
+                        getConfig_VolumeScript(params).getAbsolutePath());
+                IOUtils.exec(pb);
+            } catch (IOException ex) {
+                Log.verbose(ex);
+            }
+
+            // volume icon
+            File volumeIconFile = new File(mountedRoot, ".VolumeIcon.icns");
+            IOUtils.copyFile(getConfig_VolumeIcon(params),
+                    volumeIconFile);
+
             // Indicate that we want a custom icon
             // NB: attributes of the root directory are ignored
             // when creating the volume
@@ -356,16 +366,6 @@
                 Log.verbose(I18N.getString("message.setfile.dmg"));
             }
 
-            // We will not consider setting background image and creating link to
-            // /Application folder in DMG as critical error, since it can fail in
-            // headless enviroment.
-            try {
-                pb = new ProcessBuilder("osascript",
-                        getConfig_VolumeScript(params).getAbsolutePath());
-                IOUtils.exec(pb);
-            } catch (IOException ex) {
-                Log.verbose(ex);
-            }
         } finally {
             // Detach the temporary image
             pb = new ProcessBuilder(
@@ -493,5 +493,4 @@
     public boolean isDefault() {
         return true;
     }
-
 }