@@ -438,17 +438,17 @@ public static class LaunchServerDirectories {
438438 public void collect () {
439439 if (updatesDir == null ) updatesDir = getPath (UPDATES_NAME );
440440 if (trustStore == null ) trustStore = getPath (TRUSTSTORE_NAME );
441- if (launcherLibrariesDir == null ) launcherLibrariesDir = getPath (LAUNCHERLIBRARIES_NAME );
441+ if (launcherLibrariesDir == null ) launcherLibrariesDir = getStaticPath (LAUNCHERLIBRARIES_NAME );
442442 if (launcherLibrariesCompileDir == null )
443- launcherLibrariesCompileDir = getPath (LAUNCHERLIBRARIESCOMPILE_NAME );
443+ launcherLibrariesCompileDir = getStaticPath (LAUNCHERLIBRARIESCOMPILE_NAME );
444444 if (launcherPackDir == null )
445445 launcherPackDir = getPath (LAUNCHERPACK_NAME );
446446 if (keyDirectory == null ) keyDirectory = getPath (KEY_NAME );
447447 if (modules == null ) modules = getPath (MODULES );
448448 if (launcherModules == null ) launcherModules = getPath (LAUNCHER_MODULES );
449- if (librariesDir == null ) librariesDir = getPath (LIBRARIES );
449+ if (librariesDir == null ) librariesDir = getStaticPath (LIBRARIES );
450450 if (controlFile == null ) controlFile = getPath (CONTROL_FILE );
451- if (proguardDir == null ) proguardDir = getPath (PROGUARD_DIR );
451+ if (proguardDir == null ) proguardDir = getStaticPath (PROGUARD_DIR );
452452 if (tmpDir == null )
453453 tmpDir = Paths .get (System .getProperty ("java.io.tmpdir" )).resolve ("launchserver-%s" .formatted (SecurityHelper .randomStringToken ()));
454454 }
@@ -458,5 +458,18 @@ private Path getPath(String dirName) {
458458 if (property == null ) return dir .resolve (dirName );
459459 else return Paths .get (property );
460460 }
461+
462+ private Path getStaticPath (String dirName ) {
463+ String property = System .getProperty ("launchserver.dir." + dirName , null );
464+ if (property == null ) {
465+ String appHome = System .getenv ("APP_HOME" );
466+ if (appHome != null ) {
467+ return Path .of (appHome ).resolve (dirName );
468+ } else {
469+ return dir .resolve (dirName );
470+ }
471+ }
472+ else return Paths .get (property );
473+ }
461474 }
462475}
0 commit comments