From ebb2f1396b1aeb263a685224a2c4323ea50b9391 Mon Sep 17 00:00:00 2001 From: zab2 Date: Mon, 29 Apr 2013 16:54:36 +0000 Subject: [PATCH] Meeh's patch for trac ticket 729 --- installer/resources/i2prouter | 10 +++++++++- installer/resources/net.i2p.router.plist.template | 4 ++-- router/java/src/net/i2p/router/startup/WorkingDir.java | 9 +++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/installer/resources/i2prouter b/installer/resources/i2prouter index 67df89209..e6ea63071 100644 --- a/installer/resources/i2prouter +++ b/installer/resources/i2prouter @@ -29,7 +29,15 @@ # should have been replaced by the izpack installer. # If you did not run the installer, replace them with the appropriate paths. I2P="%INSTALL_PATH" -I2P_CONFIG_DIR="%USER_HOME/.i2p" +if [ "`uname -s`" == "Darwin" ]; then + if [ -d "%USER_HOME/Library/Application Support" ]; then + I2P_CONFIG_DIR="%USER_HOME/Library/Application Support/i2p" + else + I2P_CONFIG_DIR="%USER_HOME/.i2p" + fi +else + I2P_CONFIG_DIR="%USER_HOME/.i2p" +fi I2PTEMP="%SYSTEM_java_io_tmpdir" # PORTABLE installation: # Use the following instead. diff --git a/installer/resources/net.i2p.router.plist.template b/installer/resources/net.i2p.router.plist.template index 65fa2ac96..8f4f3fbe5 100644 --- a/installer/resources/net.i2p.router.plist.template +++ b/installer/resources/net.i2p.router.plist.template @@ -7,9 +7,9 @@ OnDemand StandardOutPath - ~/.i2p/wrapper.log + ~/Library/Application Support/i2p/wrapper.log StandardErrorPath - ~/.i2p/wrapper.log + ~/Library/Application Support/i2p/wrapper.log ProgramArguments COMMAND diff --git a/router/java/src/net/i2p/router/startup/WorkingDir.java b/router/java/src/net/i2p/router/startup/WorkingDir.java index eafaa19b8..a01881483 100644 --- a/router/java/src/net/i2p/router/startup/WorkingDir.java +++ b/router/java/src/net/i2p/router/startup/WorkingDir.java @@ -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 */ @@ -81,6 +82,14 @@ 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/"; + if (new File(home,appdata).exists()&&false==(new File(home,WORKING_DIR_DEFAULT).exists())) { + home = home+appdata; + dirf = new SecureDirectory(home, WORKING_DIR_DEFAULT_MAC); + } else { + dirf = new SecureDirectory(home, WORKING_DIR_DEFAULT); + } } else { if (DAEMON_USER.equals(System.getProperty("user.name"))) dirf = new SecureDirectory(home, WORKING_DIR_DEFAULT_DAEMON);