diff --git a/java/net/i2p/router/WinLauncher.java b/java/net/i2p/router/WinLauncher.java index 8bc3f44..2043c15 100644 --- a/java/net/i2p/router/WinLauncher.java +++ b/java/net/i2p/router/WinLauncher.java @@ -26,9 +26,6 @@ import static net.i2p.update.UpdateType.*; * router.pid - the pid of the java process. */ public class WinLauncher { - // private static WindowsUpdatePostProcessor wupp = new - // WindowsUpdatePostProcessor(); - public static void main(String[] args) throws Exception { File programs = selectProgramFile(); if (!programs.exists()) @@ -73,7 +70,7 @@ public class WinLauncher { } // then wait for the update manager - + ClientAppManager cam; while ((cam = ctx.clientAppManager()) == null) { sleep(1000); diff --git a/java/net/i2p/router/WindowsUpdatePostProcessor.java b/java/net/i2p/router/WindowsUpdatePostProcessor.java index fc32ca4..45dc450 100644 --- a/java/net/i2p/router/WindowsUpdatePostProcessor.java +++ b/java/net/i2p/router/WindowsUpdatePostProcessor.java @@ -18,23 +18,18 @@ import java.lang.Process; import java.lang.InterruptedException; public class WindowsUpdatePostProcessor implements UpdatePostProcessor { - private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(WindowsUpdatePostProcessor.class); + private final Log _log; private final RouterContext ctx; - protected static Router i2pRouter = null; - private final AtomicBoolean hook = new AtomicBoolean(); + private final String fileName = "i2p-jpackage-update.exe"; private volatile String version; private volatile File positionedFile = null; - private final String fileName = "i2p-jpackage-update.exe"; - - WindowsUpdatePostProcessor() { - this.ctx = null; - } WindowsUpdatePostProcessor(RouterContext ctx) { this.ctx = ctx; + this._log = ctx.logManager().getLog(WindowsUpdatePostProcessor.class); } public String getVersion() { @@ -73,8 +68,7 @@ public class WindowsUpdatePostProcessor implements UpdatePostProcessor { } private File moveUpdateInstaller(File file) throws IOException { - RouterContext i2pContext = i2pRouter.getContext(); - if (i2pContext != null) { + if (this.ctx != null) { File newFile = new File(workDir(), fileName); boolean renamedStatus = file.renameTo(newFile); if (renamedStatus) @@ -88,9 +82,8 @@ public class WindowsUpdatePostProcessor implements UpdatePostProcessor { } private File workDir() throws IOException { - RouterContext i2pContext = i2pRouter.getContext(); - if (i2pContext != null) { - File workDir = new File(i2pContext.getConfigDir().getAbsolutePath(), "i2p_update_win"); + if (this.ctx != null) { + File workDir = new File(this.ctx.getConfigDir().getAbsolutePath(), "i2p_update_win"); if (workDir.exists()) { if (workDir.isFile()) throw new IOException(workDir + " exists but is a file, get it out of the way");