Skip to content

Commit

Permalink
Since service installs always have an i2p.dir.config set, they don't …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
eyedeekay committed Sep 16, 2022
1 parent 0ce816a commit 1c67f06
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
2 changes: 1 addition & 1 deletion installer/resources/set_config_dir_for_nt_service.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
2 changes: 1 addition & 1 deletion installer/resources/shortcutSpec.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 0 additions & 15 deletions router/java/src/net/i2p/router/startup/WorkingDir.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,21 +109,6 @@ public static String getWorkingDir(Properties envProps, boolean migrateOldConfig
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/";
Expand Down

0 comments on commit 1c67f06

Please sign in to comment.