src/jdk.jpackage/share/classes/jdk/jpackage/internal/ApplicationLayout.java
branchJDK-8200758-branch
changeset 58416 f09bf58c1f17
parent 58302 718bd56695b3
child 58455 0d95b41d0895
--- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ApplicationLayout.java	Mon Sep 30 15:59:50 2019 -0400
+++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/ApplicationLayout.java	Mon Sep 30 19:11:19 2019 -0400
@@ -31,7 +31,7 @@
 /**
  * Application directory layout.
  */
-final class ApplicationLayout implements PathGroup.Facade<ApplicationLayout> {
+public final class ApplicationLayout implements PathGroup.Facade<ApplicationLayout> {
     enum PathRole {
         RUNTIME, APP, LAUNCHERS, DESKTOP, APP_MODS, DLLS
     }
@@ -57,46 +57,46 @@
     /**
      * Path to launchers directory.
      */
-    Path launchersDirectory() {
+    public Path launchersDirectory() {
         return pathGroup().getPath(PathRole.LAUNCHERS);
     }
 
     /**
      * Path to directory with dynamic libraries.
      */
-    Path dllDirectory() {
+    public Path dllDirectory() {
         return pathGroup().getPath(PathRole.DLLS);
     }
 
     /**
      * Path to application data directory.
      */
-    Path appDirectory() {
+    public Path appDirectory() {
         return pathGroup().getPath(PathRole.APP);
     }
 
     /**
      * Path to Java runtime directory.
      */
-    Path runtimeDirectory() {
+    public Path runtimeDirectory() {
         return pathGroup().getPath(PathRole.RUNTIME);
     }
 
     /**
      * Path to application mods directory.
      */
-    Path appModsDirectory() {
+    public Path appModsDirectory() {
         return pathGroup().getPath(PathRole.APP_MODS);
     }
 
     /**
      * Path to directory with application's desktop integration files.
      */
-    Path destktopIntegrationDirectory() {
+    public Path destktopIntegrationDirectory() {
         return pathGroup().getPath(PathRole.DESKTOP);
     }
 
-    static ApplicationLayout linuxApp() {
+    static ApplicationLayout linuxAppImage() {
         return new ApplicationLayout(Map.of(
                 PathRole.LAUNCHERS, Path.of("bin"),
                 PathRole.APP, Path.of("lib/app"),
@@ -107,21 +107,44 @@
         ));
     }
 
-    static ApplicationLayout windowsApp() {
+    static ApplicationLayout windowsAppImage() {
         return new ApplicationLayout(Map.of(
                 PathRole.LAUNCHERS, Path.of(""),
                 PathRole.APP, Path.of("app"),
                 PathRole.RUNTIME, Path.of("runtime"),
-                PathRole.DESKTOP, Path.of("")
+                PathRole.DESKTOP, Path.of(""),
+                PathRole.DLLS, Path.of(""),
+                PathRole.APP_MODS, Path.of("app/mods")
+        ));
+    }
+
+    static ApplicationLayout macAppImage() {
+        return new ApplicationLayout(Map.of(
+                PathRole.LAUNCHERS, Path.of("Contents/MacOS"),
+                PathRole.APP, Path.of("Contents/Java"),
+                PathRole.RUNTIME, Path.of("Contents/runtime"),
+                PathRole.DESKTOP, Path.of("Contents/Resources"),
+                PathRole.DLLS, Path.of("Contents/MacOS"),
+                PathRole.APP_MODS, Path.of("Contents/Java/mods")
         ));
     }
 
-    static ApplicationLayout platformApp() {
-        if (Platform.getPlatform() == Platform.WINDOWS) {
-            return windowsApp();
+
+
+    public static ApplicationLayout platformAppImage() {
+        if (Platform.isWindows()) {
+            return windowsAppImage();
         }
 
-        return linuxApp();
+        if (Platform.isLinux()) {
+            return linuxAppImage();
+        }
+
+        if (Platform.isMac()) {
+            return macAppImage();
+        }
+
+        throw new IllegalArgumentException("Unknown platform");
     }
 
     static ApplicationLayout javaRuntime() {