Add an i2p.dir.lib property

This commit is contained in:
idk
2021-10-26 16:22:36 +00:00
parent 685a2f1e39
commit 7e1c8c7983
9 changed files with 25 additions and 11 deletions

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)