diff --git a/apps/routerconsole/jsp/help.jsp b/apps/routerconsole/jsp/help.jsp index 68f1b6245..a100729da 100644 --- a/apps/routerconsole/jsp/help.jsp +++ b/apps/routerconsole/jsp/help.jsp @@ -184,7 +184,8 @@ client applications can be found on our d

Release history

- + <% File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getBaseDir(), "history.txt"); %> + diff --git a/apps/routerconsole/jsp/index.jsp b/apps/routerconsole/jsp/index.jsp index ce820f5b7..f1cd4f78f 100644 --- a/apps/routerconsole/jsp/index.jsp +++ b/apps/routerconsole/jsp/index.jsp @@ -19,7 +19,8 @@ if (System.getProperty("router.consoleNonce") == null) {
- + <% File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getBaseDir(), "docs/news.xml"); %> + @@ -30,7 +31,8 @@ if (System.getProperty("router.consoleNonce") == null) {
- + <% fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getBaseDir(), "docs/readme.html"); %> + " /> diff --git a/apps/routerconsole/jsp/nav.jsp b/apps/routerconsole/jsp/nav.jsp index 914371c78..2022de993 100644 --- a/apps/routerconsole/jsp/nav.jsp +++ b/apps/routerconsole/jsp/nav.jsp @@ -14,9 +14,10 @@ Router Console
- <% if (new File("docs/toolbar.html").exists()) { %> + <% File path = new File(net.i2p.I2PAppContext.getGlobalContext().getBaseDir(), "docs/toolbar.html"); + if (path.exists()) { %> - + <% } else { %> diff --git a/apps/systray/java/src/net/i2p/apps/systray/UrlLauncher.java b/apps/systray/java/src/net/i2p/apps/systray/UrlLauncher.java index c7524054e..55a7b5277 100644 --- a/apps/systray/java/src/net/i2p/apps/systray/UrlLauncher.java +++ b/apps/systray/java/src/net/i2p/apps/systray/UrlLauncher.java @@ -17,6 +17,7 @@ import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL; +import net.i2p.I2PAppContext; import net.i2p.util.ShellCommand; /** @@ -68,10 +69,11 @@ public class UrlLauncher { String browserString = "\"C:\\Program Files\\Internet Explorer\\iexplore.exe\" -nohome"; BufferedReader bufferedReader = null; - _shellCommand.executeSilentAndWait("regedit /E browser.reg \"HKEY_CLASSES_ROOT\\http\\shell\\open\\command\""); + File foo = new File(I2PAppContext.getGlobalContext().getTempDir(), "browser.reg"); + _shellCommand.executeSilentAndWait("regedit /E \"" + foo.getAbsolutePath() + "\" \"HKEY_CLASSES_ROOT\\http\\shell\\open\\command\""); try { - bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream("browser.reg"), "UTF-16")); + bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(foo), "UTF-16")); for (String line; (line = bufferedReader.readLine()) != null; ) { if (line.startsWith("@=")) { // we should really use the whole line and replace %1 with the url @@ -86,7 +88,7 @@ public class UrlLauncher { } catch (IOException e) { // No worries. } - new File("browser.reg").delete(); + foo.delete(); } catch (Exception e) { // Defaults to IE. } finally { diff --git a/build.xml b/build.xml index 8fadcf831..0dbd9fa2b 100644 --- a/build.xml +++ b/build.xml @@ -360,7 +360,7 @@ - + diff --git a/router/java/src/net/i2p/router/Router.java b/router/java/src/net/i2p/router/Router.java index 35518feda..8c918d93f 100644 --- a/router/java/src/net/i2p/router/Router.java +++ b/router/java/src/net/i2p/router/Router.java @@ -1076,6 +1076,7 @@ public class Router { * Unzip update file found in the router dir OR base dir, to the base dir * * If we can't write to the base dir, complain. + * Note: _log not available here. */ private void installUpdates() { File updateFile = new File(_context.getRouterDir(), UPDATE_FILE); @@ -1085,12 +1086,11 @@ public class Router { exists = updateFile.exists(); } if (exists) { + // do a simple permissions test, if it fails leave the file in place and don't restart File test = new File(_context.getBaseDir(), "history.txt"); - if ((!test.canWrite()) || (!_context.getBaseDir().canWrite())) { - String msg = "ERROR: No write permissions on " + _context.getBaseDir() + - " to extract software update file"; - System.out.println(msg); - _log.log(Log.CRIT, msg); + if ((test.exists() && !test.canWrite()) || (!_context.getBaseDir().canWrite())) { + System.out.println("ERROR: No write permissions on " + _context.getBaseDir() + + " to extract software update file"); // carry on return; } @@ -1100,10 +1100,23 @@ public class Router { System.out.println("INFO: Update installed"); else System.out.println("ERROR: Update failed!"); - boolean deleted = updateFile.delete(); - if (!deleted) { - System.out.println("ERROR: Unable to delete the update file!"); - updateFile.deleteOnExit(); + if (!ok) { + // we can't leave the file in place or we'll continually restart, so rename it + File bad = new File(_context.getRouterDir(), "BAD-" + UPDATE_FILE); + boolean renamed = updateFile.renameTo(bad); + if (renamed) { + System.out.println("Moved update file to " + bad.getAbsolutePath()); + } else { + System.out.println("Deleting file " + updateFile.getAbsolutePath()); + ok = true; // so it will be deleted + } + } + if (ok) { + boolean deleted = updateFile.delete(); + if (!deleted) { + System.out.println("ERROR: Unable to delete the update file!"); + updateFile.deleteOnExit(); + } } if (System.getProperty("wrapper.version") != null) System.out.println("INFO: Restarting after update");