diff --git a/buildscripts/launcher.sh b/buildscripts/launcher.sh index d87315d..9bec837 100755 --- a/buildscripts/launcher.sh +++ b/buildscripts/launcher.sh @@ -125,7 +125,7 @@ cd "$SCRIPT_DIR"/java net/i2p/router/CopyConfigDir.java \ net/i2p/router/WindowsServiceUtil.java \ net/i2p/router/WindowsAppUtil.java \ - net/i2p/router/WindowsUpdatePostProcessor.java \ + net/i2p/router/WinUpdatePostProcessor.java \ net/i2p/router/WinLauncher.java \ net/i2p/router/WinUpdateProcess.java \ net/i2p/router/ZipUpdateProcess.java diff --git a/java/net/i2p/router/WinLauncher.java b/java/net/i2p/router/WinLauncher.java index d2bd1c7..3e87680 100644 --- a/java/net/i2p/router/WinLauncher.java +++ b/java/net/i2p/router/WinLauncher.java @@ -26,7 +26,7 @@ import net.i2p.util.Log; */ public class WinLauncher extends WindowsAppUtil { private final CopyConfigDir copyConfigDir; - WindowsUpdatePostProcessor wupp = null; + WinUpdatePostProcessor wupp = null; private Router i2pRouter; private final Log logger; public WinLauncher() { @@ -56,48 +56,7 @@ public class WinLauncher extends WindowsAppUtil { var launcher = new WinLauncher(); launcher.setupLauncher(); int proxyTimeoutTime = 200; - ArrayList newArgsList = new ArrayList(); - - if (args != null) { - if (args.length > 0) { - for (String arg : args) { - if (arg.equals("-private")) { - launcher.logger.info( - "Private browsing is true, profile will be discarded at end of session."); - } else if (arg.equals("-chromium")) { - launcher.logger.info("Chromium will be selected before Firefox."); - } else if (arg.equals("-usability")) { - launcher.logger.info( - "Usability mode is true, using alternate extensions loadout."); - } else if (arg.equals("-noproxycheck")) { - proxyTimeoutTime = 0; - launcher.logger.info("Proxy timeout time set to zero"); - } else { - // make an effort to not let people launch into sites if the proxy - // isn't quite ready yet, but also disable the proxy timeout if - // they're reaching a router console - if (arg.startsWith("http://localhost:76")) { - newArgsList.add(arg); - proxyTimeoutTime = 0; - } else if (arg.startsWith("http://127.0.0.1:76")) { - newArgsList.add(arg); - proxyTimeoutTime = 0; - } else if (arg.startsWith("https://localhost:76")) { - newArgsList.add(arg); - proxyTimeoutTime = 0; - } else if (arg.startsWith("https://127.0.0.1:76")) { - newArgsList.add(arg); - proxyTimeoutTime = 0; - } else if (proxyTimeoutTime > 0) { - newArgsList.add(arg); - } else if (!launcher.isAvailable(4444)) { - newArgsList.add(arg); - } - } - } - } - } - + launcher.logger.info("\t" + System.getProperty("user.dir")); launcher.logger.info("\t" + System.getProperty("i2p.dir.base")); launcher.logger.info("\t" + System.getProperty("i2p.dir.config")); @@ -197,7 +156,7 @@ public class WinLauncher extends WindowsAppUtil { null) { sleep(1000); } - WindowsUpdatePostProcessor wupp = new WindowsUpdatePostProcessor(ctx); + WinUpdatePostProcessor wupp = new WinUpdatePostProcessor(ctx); um.register(wupp, UpdateType.ROUTER_SIGNED_SU3, SU3File.TYPE_EXE); um.register(wupp, UpdateType.ROUTER_DEV_SU3, SU3File.TYPE_EXE); }; diff --git a/java/net/i2p/router/WindowsUpdatePostProcessor.java b/java/net/i2p/router/WinUpdatePostProcessor.java similarity index 94% rename from java/net/i2p/router/WindowsUpdatePostProcessor.java rename to java/net/i2p/router/WinUpdatePostProcessor.java index d2c6534..3fb2050 100644 --- a/java/net/i2p/router/WindowsUpdatePostProcessor.java +++ b/java/net/i2p/router/WinUpdatePostProcessor.java @@ -16,7 +16,7 @@ import net.i2p.update.UpdateType; import net.i2p.util.Log; import net.i2p.util.SystemVersion; -public class WindowsUpdatePostProcessor implements UpdatePostProcessor { +public class WinUpdatePostProcessor implements UpdatePostProcessor { private final Log _log; private final RouterContext ctx; private final AtomicBoolean hook = new AtomicBoolean(); @@ -26,9 +26,9 @@ public class WindowsUpdatePostProcessor implements UpdatePostProcessor { private volatile File positionedFile = null; - WindowsUpdatePostProcessor(RouterContext ctx) { + WinUpdatePostProcessor(RouterContext ctx) { this.ctx = ctx; - this._log = ctx.logManager().getLog(WindowsUpdatePostProcessor.class); + this._log = ctx.logManager().getLog(WinUpdatePostProcessor.class); } public String getVersion() { return version; } diff --git a/java/net/i2p/router/WindowsAppUtil.java b/java/net/i2p/router/WindowsAppUtil.java index c20a116..ae9750b 100644 --- a/java/net/i2p/router/WindowsAppUtil.java +++ b/java/net/i2p/router/WindowsAppUtil.java @@ -4,33 +4,32 @@ import java.io.File; import net.i2p.util.Log; public class WindowsAppUtil extends WindowsServiceUtil { - protected File selectHome() { // throws Exception { - String path_override = System.getenv("I2P_CONFIG"); + private File checkPathEnvironmentVariable(String name) { + String path_override = System.getenv(name); if (path_override != null) { File path = new File(path_override); if (path != null && path.exists()) { if (path.isDirectory()) return path.getAbsoluteFile(); else - throw new RuntimeException("I2P_CONFIG is not a directory: " + path); + throw new RuntimeException(name + " is not a directory: " + path); } } - File i2p = appImageHome(); + return null; + } + + protected File selectHome() { // throws Exception { + File i2p = checkPathEnvironmentVariable("I2P_CONFIG"); + String path_override = System.getenv("I2P_CONFIG"); + if (i2p == null) + i2p = appImageHome(); return i2p; } protected File selectProgramFile() { - String path_override = System.getenv("I2P"); - if (path_override != null) { - 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); - } - } - File i2p = appImageHome(); + File i2p = checkPathEnvironmentVariable("I2P"); + if (i2p == null) + i2p = appImageHome(); return i2p; }