Allow configurable wz directory path with launch property
Example: "java -Dwz-path=<my-custom-path> -jar Cosmic.jar "
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
@echo off
|
||||
@title Cosmic
|
||||
java -Xmx2048m -jar target\Cosmic.jar
|
||||
java -Xmx2048m -Dwz-path= -jar target\Cosmic.jar
|
||||
pause
|
||||
@@ -17,7 +17,7 @@ public enum WZFiles {
|
||||
SOUND("Sound"),
|
||||
UI("UI");
|
||||
|
||||
public static final String DIRECTORY = "wz";
|
||||
public static final String DIRECTORY = getWzDirectory();
|
||||
|
||||
private final String fileName;
|
||||
|
||||
@@ -32,4 +32,15 @@ public enum WZFiles {
|
||||
public String getFilePath() {
|
||||
return getFile().getPath();
|
||||
}
|
||||
|
||||
private static String getWzDirectory() {
|
||||
// Either provide a custom directory path through the "wz-path" property when launching the .jar,
|
||||
// or don't provide one to use the default "wz" directory
|
||||
String propertyPath = System.getProperty("wz-path");
|
||||
if (propertyPath != null && new File(propertyPath).isDirectory()) {
|
||||
return propertyPath;
|
||||
}
|
||||
|
||||
return "wz";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user