8244758: DMG bundler ignores --install-dir option

Reviewed-by: asemenyuk, almatvee
This commit is contained in:
Andy Herrick 2020-05-12 19:20:28 -04:00
parent 382e5dc334
commit fe46f44bd1
4 changed files with 16 additions and 15 deletions

View File

@ -83,6 +83,17 @@ public abstract class MacBaseInstallerBundler extends AbstractBundler {
params -> "",
null);
public static final BundlerParamInfo<String> MAC_INSTALL_DIR =
new StandardBundlerParam<>(
"mac-install-dir",
String.class,
params -> {
String dir = INSTALL_DIR.fetchFrom(params);
return (dir != null) ? dir : "/Applications";
},
(s, p) -> s
);
public static final BundlerParamInfo<String> INSTALLER_NAME =
new StandardBundlerParam<> (
"mac.installerName",

View File

@ -31,6 +31,7 @@ import java.nio.file.Path;
import java.text.MessageFormat;
import java.util.*;
import static jdk.incubator.jpackage.internal.MacAppImageBuilder.ICON_ICNS;
import static jdk.incubator.jpackage.internal.MacAppImageBuilder.MAC_CF_BUNDLE_IDENTIFIER;
import static jdk.incubator.jpackage.internal.OverridableResource.createResource;
import static jdk.incubator.jpackage.internal.StandardBundlerParam.*;
@ -116,8 +117,8 @@ public class MacDmgBundler extends MacBaseInstallerBundler {
data.put("DEPLOY_VOLUME_PATH", volumePath.toString());
data.put("DEPLOY_APPLICATION_NAME", APP_NAME.fetchFrom(params));
data.put("DEPLOY_INSTALL_LOCATION", "(path to applications folder)");
data.put("DEPLOY_INSTALL_NAME", "Applications");
data.put("DEPLOY_INSTALL_LOCATION", MAC_INSTALL_DIR.fetchFrom(params));
data.put("DEPLOY_INSTALL_NAME", MAC_INSTALL_DIR.fetchFrom(params));
createResource(DEFAULT_DMG_SETUP_SCRIPT, params)
.setCategory(I18N.getString("resource.dmg-setup-script"))

View File

@ -101,17 +101,6 @@ public class MacPkgBundler extends MacBaseInstallerBundler {
},
(s, p) -> s);
public static final BundlerParamInfo<String> MAC_INSTALL_DIR =
new StandardBundlerParam<>(
"mac-install-dir",
String.class,
params -> {
String dir = INSTALL_DIR.fetchFrom(params);
return (dir != null) ? dir : "/Applications";
},
(s, p) -> s
);
public static final BundlerParamInfo<String> INSTALLER_SUFFIX =
new StandardBundlerParam<> (
"mac.pkg.installerName.suffix",

View File

@ -17,7 +17,7 @@ tell application "Finder"
set background picture of theViewOptions to POSIX file "DEPLOY_BG_FILE"
-- Create alias for install location
make new alias file at POSIX file "DEPLOY_VOLUME_PATH" to DEPLOY_INSTALL_LOCATION with properties {name:"DEPLOY_INSTALL_NAME"}
make new alias file at POSIX file "DEPLOY_VOLUME_PATH" to POSIX file "DEPLOY_INSTALL_LOCATION" with properties {name:"DEPLOY_INSTALL_NAME"}
set allTheFiles to the name of every item of theWindow
repeat with theFile in allTheFiles
@ -25,7 +25,7 @@ tell application "Finder"
if theFilePath is "/DEPLOY_APPLICATION_NAME.app" then
-- Position application location
set position of item theFile of theWindow to {120, 130}
else if theFilePath is "/DEPLOY_INSTALL_NAME" then
else if theFilePath is "DEPLOY_INSTALL_NAME" then
-- Position install location
set position of item theFile of theWindow to {390, 130}
else