propagate from branch 'i2p.i2p' (head 138d50ea0e969564bef41201439c6a99e2a45fbb)

to branch 'i2p.i2p.729' (head 74c7169e5d428b5aeaf33a401b27c33d3d37907e)
This commit is contained in:
zab2
2013-05-28 08:24:22 +00:00
3 changed files with 22 additions and 3 deletions

View File

@@ -49,6 +49,7 @@ public class WorkingDir {
private final static String PROP_BASE_DIR = "i2p.dir.base";
private final static String PROP_WORKING_DIR = "i2p.dir.config";
private final static String WORKING_DIR_DEFAULT_WINDOWS = "I2P";
private final static String WORKING_DIR_DEFAULT_MAC = "i2p";
private final static String WORKING_DIR_DEFAULT = ".i2p";
private final static String WORKING_DIR_DEFAULT_DAEMON = "i2p-config";
/** we do a couple of things differently if this is the username */
@@ -70,6 +71,7 @@ public class WorkingDir {
dir = envProps.getProperty(PROP_WORKING_DIR);
if (dir == null)
dir = System.getProperty(PROP_WORKING_DIR);
boolean isWindows = SystemVersion.isWindows();
File dirf = null;
if (dir != null) {
@@ -81,6 +83,15 @@ public class WorkingDir {
if (appdata != null)
home = appdata;
dirf = new SecureDirectory(home, WORKING_DIR_DEFAULT_WINDOWS);
} else if (SystemVersion.isMac()) {
String appdata = "/Library/Application Support/";
File old = new File(home,WORKING_DIR_DEFAULT);
if (old.exists() && old.isDirectory())
dirf = new SecureDirectory(home, WORKING_DIR_DEFAULT);
else {
home = home+appdata;
dirf = new SecureDirectory(home, WORKING_DIR_DEFAULT_MAC);
}
} else {
if (DAEMON_USER.equals(System.getProperty("user.name")))
dirf = new SecureDirectory(home, WORKING_DIR_DEFAULT_DAEMON);