Since service installs always have an i2p.dir.config set, they don't need to have a default in WorkingDir.java around line 110. However, since user installs do not have an i2p.dir.config set, at around line 80-110 we have to determine whether to use the legacy config in AppData/Roaming or the new default in AppData/Local. Use programdata environment variable becaue it is consistent with the actual path that we should be using.

This commit is contained in:
idk
2022-09-16 14:06:41 -04:00
parent 0ce816acd1
commit 1c67f06ffc
3 changed files with 2 additions and 17 deletions

View File

@@ -11,7 +11,7 @@ if "%1"=="uninstall" (
) else (
FINDSTR /I "^wrapper.java.additional.5=-Di2p.dir.config=" %_WRAPPER_CONF%
if not errorlevel 1 goto end
echo wrapper.java.additional.5=-Di2p.dir.config="%ALLUSERSPROFILE%\i2p" >> %_WRAPPER_CONF%
echo wrapper.java.additional.5=-Di2p.dir.config="%PROGRAMDATA%\i2p" >> %_WRAPPER_CONF%
goto end
)

View File

@@ -3,7 +3,7 @@
<programGroup defaultName="I2P" location="startMenu" />
<shortcut name="Open I2P Profile Folder (service)"
target="explorer"
commandLine="&quot;%allusersprofile%\i2p&quot;"
commandLine="&quot;%programdata%\i2p&quot;"
iconFile="%systemroot%\system32\shell32.dll"
iconIndex="3"
initialState="normal"

View File

@@ -109,21 +109,6 @@ public class WorkingDir {
System.err.println("System is Windows: " + home);
}
}
String programData = System.getenv("PROGRAMDATA");
String winDirSystem32 = System.getenv("WINDIR");
if (winDirSystem32 != null) {
winDirSystem32 = new File(winDirSystem32, "system32").getAbsolutePath();
}
if (winDirSystem32 != null) {
if (home.toLowerCase().startsWith(winDirSystem32.toLowerCase())) {
home = programData;
}
}
if (programData != null) {
if (home.toLowerCase().startsWith(programData.toLowerCase())) {
home = programData;
}
}
dirf = new SecureDirectory(home, WORKING_DIR_DEFAULT_WINDOWS);
} else if (SystemVersion.isMac()) {
String appdata = "/Library/Application Support/";