make the path that the install and config are placed in configurable

This commit is contained in:
idk
2022-02-17 16:02:13 -05:00
parent cedacc64ce
commit 1d0cf4aba7

View File

@@ -96,6 +96,14 @@ public class WinLauncher {
}
private static File selectHome() { // throws Exception {
String path_override = System.getenv("I2P");
File path = new File(path_override);
if (path.exists()) {
if (path.isDirectory())
return path.getAbsoluteFile();
else
throw new RuntimeException("I2P is not a directory: " + path);
}
if (SystemVersion.isWindows()) {
File home = new File(System.getProperty("user.home"));
File appData = new File(home, "AppData");
@@ -113,6 +121,14 @@ public class WinLauncher {
}
private static File selectProgramFile() {
String path_override = System.getenv("I2P_CONFIG");
File path = new File(path_override);
if (path.exists()) {
if (path.isDirectory())
return path.getAbsoluteFile();
else
throw new RuntimeException("I2P_CONFIG is not a directory: " + path);
}
if (SystemVersion.isWindows()) {
File jrehome = new File(System.getProperty("java.home"));
File programs = jrehome.getParentFile();