From 7b53b0d3ad68aaf54a803a766c43298be156bfe9 Mon Sep 17 00:00:00 2001 From: hankhill19580 <hankhill19580@gmail.com> Date: Sat, 9 Nov 2019 01:36:53 +0000 Subject: [PATCH] leave roaming appdir installs that already exist alone --- INSTALL-headless.txt | 2 +- apps/susidns/src/jsp/config.jsp | 8 ++++---- installer/java/src/net/i2p/installer/FixWinPaths.java | 6 +++--- router/java/src/net/i2p/router/startup/WorkingDir.java | 9 +++++++++ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/INSTALL-headless.txt b/INSTALL-headless.txt index 5dc50735a9..3c1fd27383 100644 --- a/INSTALL-headless.txt +++ b/INSTALL-headless.txt @@ -15,7 +15,7 @@ If you're having trouble, check the website at https://geti2p.net/, or get on irc://irc.freenode.net/#i2p I2P will create and store files and configuration data in the user directory -~/.i2p/ on Linux and %APPDATA%\I2P\ on Windows. This directory is created +~/.i2p/ on Linux and %LOCALAPPDATA%\I2P\ on Windows. This directory is created when I2P is run for the first time. It also creates files in the system temporary directory specified by the Java Virtual Machine. To change the location of these directories, or to configure I2P to diff --git a/apps/susidns/src/jsp/config.jsp b/apps/susidns/src/jsp/config.jsp index ec6ef1548e..c4eb81bca8 100644 --- a/apps/susidns/src/jsp/config.jsp +++ b/apps/susidns/src/jsp/config.jsp @@ -1,9 +1,9 @@ <% /* * Created on Sep 02, 2005 - * + * * This file is part of susidns project, see http://susi.i2p/ - * + * * Copyright (C) 2005 <susi23@mail.i2p> * * This program is free software; you can redistribute it and/or modify @@ -19,7 +19,7 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * $Revision: 1.1 $ */ @@ -85,7 +85,7 @@ <h3><%=intl._t("Hints")%></h3> <ol> <li> -<%=intl._t("File and directory paths here are relative to the addressbook's working directory, which is normally ~/.i2p/addressbook/ (Linux) or %APPDATA%\\I2P\\addressbook\\ (Windows).")%> +<%=intl._t("File and directory paths here are relative to the addressbook's working directory, which is normally ~/.i2p/addressbook/ (Linux) or %LOCALAPPDATA%\\I2P\\addressbook\\ (Windows).")%> </li> <li> <%=intl._t("If you want to manually add lines to an addressbook, add them to the private or master addressbooks.")%> diff --git a/installer/java/src/net/i2p/installer/FixWinPaths.java b/installer/java/src/net/i2p/installer/FixWinPaths.java index 59637c554c..8159109f77 100644 --- a/installer/java/src/net/i2p/installer/FixWinPaths.java +++ b/installer/java/src/net/i2p/installer/FixWinPaths.java @@ -50,11 +50,11 @@ public class FixWinPaths{ String line; while ((line = br.readLine()) != null) { if (line.startsWith("wrapper.logfile=")) - line = "wrapper.logfile=%appdata%\\i2p\\wrapper.log"; + line = "wrapper.logfile=%localappdata%\\i2p\\wrapper.log"; else if (line.startsWith("#wrapper.java.pidfile=")) - line = "#wrapper.java.pidfile=%appdata%\\i2p\\routerjvm.pid"; + line = "#wrapper.java.pidfile=%localappdata%\\i2p\\routerjvm.pid"; else if (line.startsWith("#wrapper.pidfile=")) - line = "#wrapper.pidfile=%appdata%\\i2p\\i2p.pid"; + line = "#wrapper.pidfile=%localappdata%\\i2p\\i2p.pid"; if (line.contains("\\i2p/")) line = line.replace("\\i2p/", "\\i2p\\"); if (line.contains("lib/")) diff --git a/router/java/src/net/i2p/router/startup/WorkingDir.java b/router/java/src/net/i2p/router/startup/WorkingDir.java index c719022ddd..6dfbf04277 100644 --- a/router/java/src/net/i2p/router/startup/WorkingDir.java +++ b/router/java/src/net/i2p/router/startup/WorkingDir.java @@ -83,6 +83,15 @@ public class WorkingDir { String appdata = System.getenv("LOCALAPPDATA"); if (appdata != null) home = appdata; + // Don't mess with existing Roaming Application Data installs, + // in case somebody is using roaming appdata for a reason + // already. In new installs, use local appdata by default. -idk + String oldappdata = System.getenv("APPDATA"); + if (oldappdata != null) { + File checkOld = new File(oldappdata, WORKING_DIR_DEFAULT_WINDOWS); + if (checkOld.exists() && checkOld.isDirectory()) + home = appdata; + } dirf = new SecureDirectory(home, WORKING_DIR_DEFAULT_WINDOWS); } else if (SystemVersion.isMac()) { String appdata = "/Library/Application Support/"; -- GitLab