Skip to content

Commit 30068c0

Browse files
committed
Update GenerateDmg.java
1 parent c9aa675 commit 30068c0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ public File apply(Packager packager) throws Exception {
8383
Logger.info("Creating image: " + tempDmgFile.getAbsolutePath());
8484
execute("hdiutil", "create", "-srcfolder", appFolder, "-volname", volumeName, "-ov", "-fs", "HFS+", "-format", "UDRW", tempDmgFile);
8585

86-
Logger.info("Unmounting disk image (if mounted)...");
87-
execute("hdiutil", "detach", volumeName);
86+
Logger.info("Unmounting disk image ...");
87+
if (mountFolder.exists()) {
88+
execute("hdiutil", "detach", mountFolder);
89+
}
8890

8991
// mounts image
9092
Logger.info("Mounting image: " + tempDmgFile.getAbsolutePath());
@@ -124,7 +126,7 @@ public File apply(Packager packager) throws Exception {
124126

125127
// unmounts
126128
Logger.info("Unmounting disk image...");
127-
execute("hdiutil", "detach", volumeName);
129+
execute("hdiutil", "detach", mountFolder);
128130

129131
// compress image
130132
Logger.info("Compressing disk image...");

0 commit comments

Comments
 (0)