Compare commits

..

5 Commits

Author SHA1 Message Date
eyedeekay
81d81adc4c no more self-relaunch! 2024-03-08 22:48:24 -05:00
eyedeekay
b82986ccf4 set properties in constructor 2024-03-08 22:00:46 -05:00
eyedeekay
4ef50bb85a set properties in constructor 2024-03-08 21:35:50 -05:00
eyedeekay
b8809bed47 i2pRouter in WinLauncher can't be final because of REGISTER_UPP 2024-03-08 19:43:26 -05:00
eyedeekay
16fc4da41c null check i2pRouter in REGISTER_UPP 2024-03-08 19:36:29 -05:00

View File

@@ -27,9 +27,26 @@ import net.i2p.util.Log;
public class WinLauncher extends WindowsAppUtil {
private final CopyConfigDir copyConfigDir;
WindowsUpdatePostProcessor wupp = null;
private final Router i2pRouter;
private Router i2pRouter;
private final Log logger;
public WinLauncher() {
File programs = programFile();
File home = homeDir();
System.setProperty(
"i2p.dir.base",
new File(programs.getAbsolutePath(), "config").getAbsolutePath());
System.setProperty("i2p.dir.config", home.getAbsolutePath());
System.setProperty("router.pid",
String.valueOf(ProcessHandle.current().pid()));
/**
* IMPORTANT: You must set user.dir to the same directory where the
* jpackage is intstalled, or when the launcher tries to re-run itself
* to start the browser, it will start in the wrong directory and fail
* to find the JVM and Runtime bundle. This broke Windows 11 installs.
*/
System.setProperty("user.dir", programs.getAbsolutePath());
i2pRouter = new Router(routerConfig(), System.getProperties());
copyConfigDir = new CopyConfigDir(i2pRouter.getContext());
logger = i2pRouter.getContext().logManager().getLog(WinLauncher.class);
@@ -81,22 +98,6 @@ public class WinLauncher extends WindowsAppUtil {
}
}
File programs = launcher.programFile();
File home = launcher.homeDir();
System.setProperty(
"i2p.dir.base",
new File(programs.getAbsolutePath(), "config").getAbsolutePath());
System.setProperty("i2p.dir.config", home.getAbsolutePath());
System.setProperty("router.pid",
String.valueOf(ProcessHandle.current().pid()));
/**
* IMPORTANT: You must set user.dir to the same directory where the
* jpackage is intstalled, or when the launcher tries to re-run itself
* to start the browser, it will start in the wrong directory and fail
* to find the JVM and Runtime bundle. This broke Windows 11 installs.
*/
System.setProperty("user.dir", programs.getAbsolutePath());
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"));
@@ -121,12 +122,7 @@ public class WinLauncher extends WindowsAppUtil {
}
if (!launcher.isInstalled("i2p")) {
if (launcher.i2pRouter.saveConfig("routerconsole.browser", null)) {
launcher.logger.info("removed routerconsole.browser config");
}
if (launcher.i2pRouter.saveConfig("routerconsole.browser",
launcher.appImageExe() +
" -noproxycheck")) {
if (launcher.i2pRouter.saveConfig("routerconsole.browser", "NUL")) {
launcher.logger.info("updated routerconsole.browser config " +
launcher.appImageExe());
}