2828 * Stores metadata about this application.
2929 */
3030public final class Metadata {
31- private Metadata () {}
31+ private Metadata () {
32+ }
3233
3334 public static final String NAME = "HMCL" ;
3435 public static final String FULL_NAME = "Hello Minecraft! Launcher" ;
@@ -51,25 +52,34 @@ private Metadata() {}
5152 public static final String BUILD_CHANNEL = JarUtils .getManifestAttribute ("Build-Channel" , "nightly" );
5253 public static final String GITHUB_SHA = JarUtils .getManifestAttribute ("GitHub-SHA" , null );
5354
55+ public static final Path CURRENT_DIRECTORY = Paths .get (System .getProperty ("user.dir" )).toAbsolutePath ().normalize ();
5456 public static final Path MINECRAFT_DIRECTORY = OperatingSystem .getWorkingDirectory ("minecraft" );
55- public static final Path HMCL_DIRECTORY ;
57+ public static final Path HMCL_GLOBAL_DIRECTORY ;
58+ public static final Path HMCL_CURRENT_DIRECTORY ;
59+ public static final Path DEPENDENCIES_DIRECTORY ;
5660
5761 static {
5862 String hmclHome = System .getProperty ("hmcl.home" );
5963 if (hmclHome == null ) {
6064 if (OperatingSystem .CURRENT_OS .isLinuxOrBSD ()) {
6165 String xdgData = System .getenv ("XDG_DATA_HOME" );
6266 if (StringUtils .isNotBlank (xdgData )) {
63- HMCL_DIRECTORY = Paths .get (xdgData , "hmcl" ).toAbsolutePath ();
67+ HMCL_GLOBAL_DIRECTORY = Paths .get (xdgData , "hmcl" ).toAbsolutePath (). normalize ();
6468 } else {
65- HMCL_DIRECTORY = Paths .get (System .getProperty ("user.home" , "." ), ".local" , "share" , "hmcl" ).toAbsolutePath ();
69+ HMCL_GLOBAL_DIRECTORY = Paths .get (System .getProperty ("user.home" ), ".local" , "share" , "hmcl" ).toAbsolutePath (). normalize ();
6670 }
6771 } else {
68- HMCL_DIRECTORY = OperatingSystem .getWorkingDirectory ("hmcl" );
72+ HMCL_GLOBAL_DIRECTORY = OperatingSystem .getWorkingDirectory ("hmcl" );
6973 }
7074 } else {
71- HMCL_DIRECTORY = Paths .get (hmclHome ).toAbsolutePath ().normalize ();
75+ HMCL_GLOBAL_DIRECTORY = Paths .get (hmclHome ).toAbsolutePath ().normalize ();
7276 }
77+
78+ String hmclCurrentDir = System .getProperty ("hmcl.dir" );
79+ HMCL_CURRENT_DIRECTORY = hmclCurrentDir != null
80+ ? Paths .get (hmclCurrentDir ).toAbsolutePath ().normalize ()
81+ : CURRENT_DIRECTORY .resolve (".hmcl" );
82+ DEPENDENCIES_DIRECTORY = HMCL_CURRENT_DIRECTORY .resolve ("dependencies" );
7383 }
7484
7585 public static boolean isStable () {
0 commit comments