From 1d0cf4aba78569118fb6d03b439e222b89eefd3c Mon Sep 17 00:00:00 2001 From: idk Date: Thu, 17 Feb 2022 16:02:13 -0500 Subject: [PATCH] make the path that the install and config are placed in configurable --- java/net/i2p/router/WinLauncher.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/java/net/i2p/router/WinLauncher.java b/java/net/i2p/router/WinLauncher.java index 2043c15..0a32f42 100644 --- a/java/net/i2p/router/WinLauncher.java +++ b/java/net/i2p/router/WinLauncher.java @@ -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();