forked from I2P_Developers/i2p.i2p
Minor change in routerconsole and core code for making I2P work great
in "portable" mode.
This commit is contained in:
@ -6,10 +6,7 @@ import java.io.FileFilter;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.InetAddress;
|
import java.net.*;
|
||||||
import java.net.Inet4Address;
|
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.net.ServerSocket;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@ -410,8 +407,26 @@ public class RouterConsoleRunner implements RouterApp {
|
|||||||
if (!workDirCreated)
|
if (!workDirCreated)
|
||||||
System.err.println("ERROR: Unable to create Jetty temporary work directory");
|
System.err.println("ERROR: Unable to create Jetty temporary work directory");
|
||||||
|
|
||||||
|
// NOTE
|
||||||
|
// This code was added by Meeh @ 22 Apr 2018 for use in the browser bundle.
|
||||||
|
// In the case of a portable mode, the jar in question isn't routerconsole.jar but itself.
|
||||||
|
String isPortableStr = System.getProperty("i2p.dir.portableMode");
|
||||||
|
boolean isPortable = Boolean.parseBoolean(isPortableStr);
|
||||||
|
|
||||||
|
String routerConsoleJar = "";
|
||||||
// so Jetty can find WebAppConfiguration
|
// so Jetty can find WebAppConfiguration
|
||||||
System.setProperty("jetty.class.path", _context.getBaseDir() + "/lib/routerconsole.jar");
|
if (isPortable) {
|
||||||
|
try {
|
||||||
|
routerConsoleJar = new File(RouterConsoleRunner.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getAbsolutePath();
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
// This shouln't be able to happen.
|
||||||
|
System.err.println("ERROR: Fatal portable error, can't locate where I (jarfile) am.");
|
||||||
|
return; // Yes, cancel at this point.
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
routerConsoleJar = _context.getBaseDir() + "/lib/routerconsole.jar";
|
||||||
|
}
|
||||||
|
System.setProperty("jetty.class.path", routerConsoleJar);
|
||||||
// FIXME
|
// FIXME
|
||||||
// http://dev.eclipse.org/mhonarc/lists/jetty-users/msg03487.html
|
// http://dev.eclipse.org/mhonarc/lists/jetty-users/msg03487.html
|
||||||
//_server.setGracefulShutdown(1000);
|
//_server.setGracefulShutdown(1000);
|
||||||
|
@ -322,16 +322,19 @@ public class I2PAppContext {
|
|||||||
} else {
|
} else {
|
||||||
_appDir = _routerDir;
|
_appDir = _routerDir;
|
||||||
}
|
}
|
||||||
/******
|
String isPortableStr = System.getProperty("i2p.dir.portableMode");
|
||||||
(new Exception("Initialized by")).printStackTrace();
|
boolean isPortable = Boolean.parseBoolean(isPortableStr);
|
||||||
System.err.println("Base directory: " + _baseDir.getAbsolutePath());
|
if (isPortable) {
|
||||||
System.err.println("Config directory: " + _configDir.getAbsolutePath());
|
// In portable we like debug information :)
|
||||||
System.err.println("Router directory: " + _routerDir.getAbsolutePath());
|
//(new Exception("Initialized by")).printStackTrace();
|
||||||
System.err.println("App directory: " + _appDir.getAbsolutePath());
|
System.err.println("Base directory: " + _baseDir.getAbsolutePath());
|
||||||
System.err.println("Log directory: " + _logDir.getAbsolutePath());
|
System.err.println("Config directory: " + _configDir.getAbsolutePath());
|
||||||
System.err.println("PID directory: " + _pidDir.getAbsolutePath());
|
System.err.println("Router directory: " + _routerDir.getAbsolutePath());
|
||||||
System.err.println("Temp directory: " + getTempDir().getAbsolutePath());
|
System.err.println("App directory: " + _appDir.getAbsolutePath());
|
||||||
******/
|
System.err.println("Log directory: " + _logDir.getAbsolutePath());
|
||||||
|
System.err.println("PID directory: " + _pidDir.getAbsolutePath());
|
||||||
|
System.err.println("Temp directory: " + getTempDir().getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
if (doInit) {
|
if (doInit) {
|
||||||
// Bad practice, sets a static field to this in constructor.
|
// Bad practice, sets a static field to this in constructor.
|
||||||
|
Reference in New Issue
Block a user