leave roaming appdir installs that already exist alone

This commit is contained in:
hankhill19580
2019-11-09 01:36:53 +00:00
parent ff293d50a9
commit 7b53b0d3ad
4 changed files with 17 additions and 8 deletions

View File

@ -15,7 +15,7 @@ If you're having trouble, check the
website at https://geti2p.net/, or get on irc://irc.freenode.net/#i2p 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 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 when I2P is run for the first time. It also creates files in the system
temporary directory specified by the Java Virtual Machine. temporary directory specified by the Java Virtual Machine.
To change the location of these directories, or to configure I2P to To change the location of these directories, or to configure I2P to

View File

@ -85,7 +85,7 @@
<h3><%=intl._t("Hints")%></h3> <h3><%=intl._t("Hints")%></h3>
<ol> <ol>
<li> <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>
<li> <li>
<%=intl._t("If you want to manually add lines to an addressbook, add them to the private or master addressbooks.")%> <%=intl._t("If you want to manually add lines to an addressbook, add them to the private or master addressbooks.")%>

View File

@ -50,11 +50,11 @@ public class FixWinPaths{
String line; String line;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
if (line.startsWith("wrapper.logfile=")) 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=")) 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=")) else if (line.startsWith("#wrapper.pidfile="))
line = "#wrapper.pidfile=%appdata%\\i2p\\i2p.pid"; line = "#wrapper.pidfile=%localappdata%\\i2p\\i2p.pid";
if (line.contains("\\i2p/")) if (line.contains("\\i2p/"))
line = line.replace("\\i2p/", "\\i2p\\"); line = line.replace("\\i2p/", "\\i2p\\");
if (line.contains("lib/")) if (line.contains("lib/"))

View File

@ -83,6 +83,15 @@ public class WorkingDir {
String appdata = System.getenv("LOCALAPPDATA"); String appdata = System.getenv("LOCALAPPDATA");
if (appdata != null) if (appdata != null)
home = appdata; 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); dirf = new SecureDirectory(home, WORKING_DIR_DEFAULT_WINDOWS);
} else if (SystemVersion.isMac()) { } else if (SystemVersion.isMac()) {
String appdata = "/Library/Application Support/"; String appdata = "/Library/Application Support/";