Compare commits

...

5 Commits

9 changed files with 25 additions and 11 deletions

View File

@ -455,7 +455,7 @@ public class RouterConsoleRunner implements RouterApp {
System.err.println("ERROR: Unable to create Jetty temporary work directory");
// so Jetty can find WebAppConfiguration
System.setProperty("jetty.class.path", _context.getBaseDir() + "/lib/routerconsole.jar");
System.setProperty("jetty.class.path", (new File(_context.getLibDir(), "routerconsole.jar")).getPath());
// FIXME
// http://dev.eclipse.org/mhonarc/lists/jetty-users/msg03487.html
//_server.setGracefulShutdown(1000);

View File

@ -87,7 +87,7 @@ public class WebAppConfiguration implements Configuration {
****/
I2PAppContext i2pContext = I2PAppContext.getGlobalContext();
File libDir = new File(i2pContext.getBaseDir(), "lib");
File libDir = i2pContext.getLibDir();
// FIXME this only works if war is the same name as the plugin
File pluginDir = new File(i2pContext.getConfigDir(),
PluginStarter.PLUGIN_DIR + ctxPath);
@ -180,7 +180,7 @@ public class WebAppConfiguration implements Configuration {
} else {
// Java 9 - assume everything in lib/ is in the classpath
// except addressbook.jar
File libDir = new File(ctx.getBaseDir(), "lib");
File libDir = ctx.getLibDir();
File[] files = libDir.listFiles(new FileSuffixFilter(".jar"));
if (files != null) {
for (int i = 0; i < files.length; i++) {

View File

@ -63,7 +63,7 @@ public class FileDumpHelper extends HelperBase {
}
// our jars
File dir = new File(_context.getBaseDir(), "lib");
File dir = _context.getLibDir();
buf.append("<tr><th class=\"subheading routerfiles\" colspan=\"9\"><b>Router Jar Files:</b> <code>");
buf.append(dir.getAbsolutePath());
buf.append("</code></th></tr>\n");

View File

@ -211,8 +211,8 @@ public class LogsHelper extends HelperBase {
* @since 0.9.35
*/
public String getBuiltBy() {
File baseDir = _context.getBaseDir();
File f = new File(new File(baseDir, "lib"), "i2p.jar");
File libDir = _context.getLibDir();
File f = new File(libDir, "i2p.jar");
Attributes att = FileDumpHelper.attributes(f);
if (att != null) {
String s = FileDumpHelper.getAtt(att, "Built-By");

View File

@ -111,6 +111,7 @@ public class I2PAppContext {
private final File _logDir;
private final File _appDir;
private volatile File _tmpDir;
private final File _libDir;
private final Random _tmpDirRand = new Random();
private final ClientAppManager _appManager;
// split up big lock on this to avoid deadlocks
@ -317,6 +318,13 @@ public class I2PAppContext {
} else {
_appDir = _routerDir;
}
s = getProperty("i2p.dir.lib");
if (s != null) {
_libDir = new File(s);
} else {
_libDir = new File(_baseDir, "lib");
}
String isPortableStr = System.getProperty("i2p.dir.portableMode");
boolean isPortable = Boolean.parseBoolean(isPortableStr);
if (isPortable) {
@ -438,6 +446,13 @@ public class I2PAppContext {
}
}
/**
* This is the library dir, which is usually $I2P/lib.
* @return dir constant for the life of the context
* @since 0.9.52
*/
public File getLibDir() { return _libDir; }
/** don't rely on deleteOnExit() */
public void deleteTempDir() {
synchronized (_lock1) {

View File

@ -935,8 +935,7 @@ public final class KeyStoreUtil {
a.add("-keysize"); a.add(Integer.toString(keySize));
a.add("-keypass"); a.add(keyPW);
if (keyAlg.equals("Ed") || keyAlg.equals("EdDSA") || keyAlg.equals("ElGamal")) {
File f = I2PAppContext.getGlobalContext().getBaseDir();
f = new File(f, "lib");
File f = I2PAppContext.getGlobalContext().getLibDir();
f = new File(f, "i2p.jar");
// providerpath is not in the man page; see keytool -genkey -help
a.add("-providerpath"); a.add(f.getAbsolutePath());

View File

@ -116,7 +116,7 @@ public class BuildTime {
private static long getBuildTime(SimpleDateFormat fmt, String jar) {
if (SystemVersion.isAndroid())
return 0;
File f = new File(I2PAppContext.getGlobalContext().getBaseDir(), "lib");
File f = I2PAppContext.getGlobalContext().getLibDir();
f = new File(f, jar);
Attributes atts = attributes(f);
if (atts == null)

View File

@ -1349,7 +1349,7 @@ public class Router implements RouterClock.ClockShiftListener {
// only do this on these OSes
boolean goodOS = isWin || isMac ||
osName.contains("linux") || osName.contains("freebsd");
File jbigiJar = new File(_context.getBaseDir(), "lib/jbigi.jar");
File jbigiJar = new File(_context.getLibDir(), "jbigi.jar");
if (goodOS && jbigiJar.exists() && _context.getBaseDir().canWrite()) {
String libPrefix = isWin ? "" : "lib";
String libSuffix = isWin ? ".dll" : isMac ? ".jnilib" : ".so";

View File

@ -135,7 +135,7 @@ public class InstallUpdate {
boolean goodOS = isWin || isMac ||
osName.contains("linux") || osName.contains("freebsd");
File jbigiJar = new File(context.getBaseDir(), "lib/jbigi.jar");
File jbigiJar = new File(context.getLibDir(), "jbigi.jar");
if (goodOS && jbigiJar.exists()) {
String libPrefix = (isWin ? "" : "lib");
String libSuffix = (isWin ? ".dll" : isMac ? ".jnilib" : ".so");