src/jdk.jpackage/share/classes/jdk/jpackage/internal/ApplicationLayout.java
branchJDK-8200758-branch
changeset 58302 718bd56695b3
parent 58301 e0efb29609bd
child 58416 f09bf58c1f17
equal deleted inserted replaced
58301:e0efb29609bd 58302:718bd56695b3
    31 /**
    31 /**
    32  * Application directory layout.
    32  * Application directory layout.
    33  */
    33  */
    34 final class ApplicationLayout implements PathGroup.Facade<ApplicationLayout> {
    34 final class ApplicationLayout implements PathGroup.Facade<ApplicationLayout> {
    35     enum PathRole {
    35     enum PathRole {
    36         RUNTIME, APP, LAUNCHERS_DIR, DESKTOP
    36         RUNTIME, APP, LAUNCHERS, DESKTOP, APP_MODS, DLLS
    37     }
    37     }
    38 
    38 
    39     ApplicationLayout(Map<Object, Path> paths) {
    39     ApplicationLayout(Map<Object, Path> paths) {
    40         data = new PathGroup(paths);
    40         data = new PathGroup(paths);
    41     }
    41     }
    56 
    56 
    57     /**
    57     /**
    58      * Path to launchers directory.
    58      * Path to launchers directory.
    59      */
    59      */
    60     Path launchersDirectory() {
    60     Path launchersDirectory() {
    61         return pathGroup().getPath(PathRole.LAUNCHERS_DIR);
    61         return pathGroup().getPath(PathRole.LAUNCHERS);
       
    62     }
       
    63 
       
    64     /**
       
    65      * Path to directory with dynamic libraries.
       
    66      */
       
    67     Path dllDirectory() {
       
    68         return pathGroup().getPath(PathRole.DLLS);
    62     }
    69     }
    63 
    70 
    64     /**
    71     /**
    65      * Path to application data directory.
    72      * Path to application data directory.
    66      */
    73      */
    74     Path runtimeDirectory() {
    81     Path runtimeDirectory() {
    75         return pathGroup().getPath(PathRole.RUNTIME);
    82         return pathGroup().getPath(PathRole.RUNTIME);
    76     }
    83     }
    77 
    84 
    78     /**
    85     /**
       
    86      * Path to application mods directory.
       
    87      */
       
    88     Path appModsDirectory() {
       
    89         return pathGroup().getPath(PathRole.APP_MODS);
       
    90     }
       
    91 
       
    92     /**
    79      * Path to directory with application's desktop integration files.
    93      * Path to directory with application's desktop integration files.
    80      */
    94      */
    81     Path destktopIntegrationDirectory() {
    95     Path destktopIntegrationDirectory() {
    82         return pathGroup().getPath(PathRole.DESKTOP);
    96         return pathGroup().getPath(PathRole.DESKTOP);
    83     }
    97     }
    84 
    98 
    85     static ApplicationLayout unixApp() {
    99     static ApplicationLayout linuxApp() {
    86         return new ApplicationLayout(Map.of(
   100         return new ApplicationLayout(Map.of(
    87                 PathRole.LAUNCHERS_DIR, Path.of("bin"),
   101                 PathRole.LAUNCHERS, Path.of("bin"),
    88                 PathRole.APP, Path.of("app"),
   102                 PathRole.APP, Path.of("lib/app"),
    89                 PathRole.RUNTIME, Path.of("runtime"),
   103                 PathRole.RUNTIME, Path.of("lib/runtime"),
    90                 PathRole.DESKTOP, Path.of("bin")
   104                 PathRole.DESKTOP, Path.of("lib"),
       
   105                 PathRole.DLLS, Path.of("lib"),
       
   106                 PathRole.APP_MODS, Path.of("lib/app/mods")
    91         ));
   107         ));
    92     }
   108     }
    93 
   109 
    94     static ApplicationLayout windowsApp() {
   110     static ApplicationLayout windowsApp() {
    95         return new ApplicationLayout(Map.of(
   111         return new ApplicationLayout(Map.of(
    96                 PathRole.LAUNCHERS_DIR, Path.of(""),
   112                 PathRole.LAUNCHERS, Path.of(""),
    97                 PathRole.APP, Path.of("app"),
   113                 PathRole.APP, Path.of("app"),
    98                 PathRole.RUNTIME, Path.of("runtime"),
   114                 PathRole.RUNTIME, Path.of("runtime"),
    99                 PathRole.DESKTOP, Path.of("")
   115                 PathRole.DESKTOP, Path.of("")
   100         ));
   116         ));
   101     }
   117     }
   103     static ApplicationLayout platformApp() {
   119     static ApplicationLayout platformApp() {
   104         if (Platform.getPlatform() == Platform.WINDOWS) {
   120         if (Platform.getPlatform() == Platform.WINDOWS) {
   105             return windowsApp();
   121             return windowsApp();
   106         }
   122         }
   107 
   123 
   108         return unixApp();
   124         return linuxApp();
   109     }
   125     }
   110 
   126 
   111     static ApplicationLayout javaRuntime() {
   127     static ApplicationLayout javaRuntime() {
   112         return new ApplicationLayout(Map.of(PathRole.RUNTIME, Path.of("")));
   128         return new ApplicationLayout(Map.of(PathRole.RUNTIME, Path.of("")));
   113     }
   129     }