I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit f6ec3f66 authored by zzz's avatar zzz
Browse files

* Router: Support i2p.dir.base and i2p.dir.config passed in via properties

parent 2f0b9a8f
No related branches found
No related tags found
No related merge requests found
...@@ -52,8 +52,12 @@ public class WorkingDir { ...@@ -52,8 +52,12 @@ public class WorkingDir {
* Only call this once on router invocation. * Only call this once on router invocation.
* Caller should store the return value for future reference. * Caller should store the return value for future reference.
*/ */
public static String getWorkingDir(boolean migrateOldConfig) { public static String getWorkingDir(Properties envProps, boolean migrateOldConfig) {
String dir = System.getProperty(PROP_WORKING_DIR); String dir = null;
if (envProps != null)
dir = envProps.getProperty(PROP_WORKING_DIR);
if (dir == null)
dir = System.getProperty(PROP_WORKING_DIR);
boolean isWindows = System.getProperty("os.name").startsWith("Win"); boolean isWindows = System.getProperty("os.name").startsWith("Win");
File dirf = null; File dirf = null;
if (dir != null) { if (dir != null) {
...@@ -69,10 +73,16 @@ public class WorkingDir { ...@@ -69,10 +73,16 @@ public class WorkingDir {
dirf = new File(home, WORKING_DIR_DEFAULT); dirf = new File(home, WORKING_DIR_DEFAULT);
} }
} }
// where we are now // where we are now
String cwd = System.getProperty(PROP_BASE_DIR); String cwd = null;
if (cwd == null) if (envProps != null)
cwd = System.getProperty("user.dir"); cwd = envProps.getProperty(PROP_BASE_DIR);
if (cwd == null) {
cwd = System.getProperty(PROP_BASE_DIR);
if (cwd == null)
cwd = System.getProperty("user.dir");
}
// Check for a hosts.txt file, if it exists then I2P is there // Check for a hosts.txt file, if it exists then I2P is there
File oldDirf = new File(cwd); File oldDirf = new File(cwd);
......
...@@ -137,7 +137,7 @@ public class Router { ...@@ -137,7 +137,7 @@ public class Router {
// Do we copy all the data files to the new directory? default false // Do we copy all the data files to the new directory? default false
String migrate = System.getProperty("i2p.dir.migrate"); String migrate = System.getProperty("i2p.dir.migrate");
boolean migrateFiles = Boolean.valueOf(migrate).booleanValue(); boolean migrateFiles = Boolean.valueOf(migrate).booleanValue();
String userDir = WorkingDir.getWorkingDir(migrateFiles); String userDir = WorkingDir.getWorkingDir(envProps, migrateFiles);
// Use the router.config file specified in the router.configLocation property // Use the router.config file specified in the router.configLocation property
// (default "router.config"), // (default "router.config"),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment