Get rid of WindowsUpdatePostProcessor() constructor with no arguments, since this will lead to a null context which will break everything and is not useful/used anyway
This commit is contained in:
@ -26,9 +26,6 @@ import static net.i2p.update.UpdateType.*;
|
|||||||
* router.pid - the pid of the java process.
|
* router.pid - the pid of the java process.
|
||||||
*/
|
*/
|
||||||
public class WinLauncher {
|
public class WinLauncher {
|
||||||
// private static WindowsUpdatePostProcessor wupp = new
|
|
||||||
// WindowsUpdatePostProcessor();
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
File programs = selectProgramFile();
|
File programs = selectProgramFile();
|
||||||
if (!programs.exists())
|
if (!programs.exists())
|
||||||
@ -73,7 +70,7 @@ public class WinLauncher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// then wait for the update manager
|
// then wait for the update manager
|
||||||
|
|
||||||
ClientAppManager cam;
|
ClientAppManager cam;
|
||||||
while ((cam = ctx.clientAppManager()) == null) {
|
while ((cam = ctx.clientAppManager()) == null) {
|
||||||
sleep(1000);
|
sleep(1000);
|
||||||
|
@ -18,23 +18,18 @@ import java.lang.Process;
|
|||||||
import java.lang.InterruptedException;
|
import java.lang.InterruptedException;
|
||||||
|
|
||||||
public class WindowsUpdatePostProcessor implements UpdatePostProcessor {
|
public class WindowsUpdatePostProcessor implements UpdatePostProcessor {
|
||||||
private final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(WindowsUpdatePostProcessor.class);
|
private final Log _log;
|
||||||
private final RouterContext ctx;
|
private final RouterContext ctx;
|
||||||
protected static Router i2pRouter = null;
|
|
||||||
|
|
||||||
private final AtomicBoolean hook = new AtomicBoolean();
|
private final AtomicBoolean hook = new AtomicBoolean();
|
||||||
|
private final String fileName = "i2p-jpackage-update.exe";
|
||||||
|
|
||||||
private volatile String version;
|
private volatile String version;
|
||||||
|
|
||||||
private volatile File positionedFile = null;
|
private volatile File positionedFile = null;
|
||||||
private final String fileName = "i2p-jpackage-update.exe";
|
|
||||||
|
|
||||||
WindowsUpdatePostProcessor() {
|
|
||||||
this.ctx = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
WindowsUpdatePostProcessor(RouterContext ctx) {
|
WindowsUpdatePostProcessor(RouterContext ctx) {
|
||||||
this.ctx = ctx;
|
this.ctx = ctx;
|
||||||
|
this._log = ctx.logManager().getLog(WindowsUpdatePostProcessor.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
@ -73,8 +68,7 @@ public class WindowsUpdatePostProcessor implements UpdatePostProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private File moveUpdateInstaller(File file) throws IOException {
|
private File moveUpdateInstaller(File file) throws IOException {
|
||||||
RouterContext i2pContext = i2pRouter.getContext();
|
if (this.ctx != null) {
|
||||||
if (i2pContext != null) {
|
|
||||||
File newFile = new File(workDir(), fileName);
|
File newFile = new File(workDir(), fileName);
|
||||||
boolean renamedStatus = file.renameTo(newFile);
|
boolean renamedStatus = file.renameTo(newFile);
|
||||||
if (renamedStatus)
|
if (renamedStatus)
|
||||||
@ -88,9 +82,8 @@ public class WindowsUpdatePostProcessor implements UpdatePostProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private File workDir() throws IOException {
|
private File workDir() throws IOException {
|
||||||
RouterContext i2pContext = i2pRouter.getContext();
|
if (this.ctx != null) {
|
||||||
if (i2pContext != null) {
|
File workDir = new File(this.ctx.getConfigDir().getAbsolutePath(), "i2p_update_win");
|
||||||
File workDir = new File(i2pContext.getConfigDir().getAbsolutePath(), "i2p_update_win");
|
|
||||||
if (workDir.exists()) {
|
if (workDir.exists()) {
|
||||||
if (workDir.isFile())
|
if (workDir.isFile())
|
||||||
throw new IOException(workDir + " exists but is a file, get it out of the way");
|
throw new IOException(workDir + " exists but is a file, get it out of the way");
|
||||||
|
Reference in New Issue
Block a user