From 9e6f993af5a658bb7f77e40363694baba0908cf5 Mon Sep 17 00:00:00 2001 From: kytv Date: Wed, 31 Aug 2011 17:11:23 +0000 Subject: [PATCH] De-fuglify the service path in Windows The default service path in Windows is fugly and not very convenient. I2P uses the correct path, but if you want to access snark or eepsite data, one must go to %SYSTEMROOT%\config\systemprofile\AppData\Roaming\I2P\ (Vista/7) or %SYSTEMROOT%\system32\config\systemprofile\Application Data\I2P (XP/2003). If this wasn't bad enough, in some cases one must take ownership of this path and grant permission to him- or herself to access the folder. With this changeset, I'm setting the path to %ALLUSERSPROFILE%\Application Data\I2P as well as adding a shortcut to the I2P folder in the Start menu. --- installer/install.xml | 4 ++-- .../resources/install_i2p_service_winnt.bat | 4 +++- .../set_config_dir_for_nt_service.bat | 18 ++++++++++++++++-- installer/resources/shortcutSpec.xml | 10 ++++++++++ .../resources/uninstall_i2p_service_winnt.bat | 1 + .../java/src/net/i2p/router/RouterVersion.java | 2 +- 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/installer/install.xml b/installer/install.xml index c0ae82c38..e191c8eb7 100644 --- a/installer/install.xml +++ b/installer/install.xml @@ -141,7 +141,7 @@ SYSTEM_sun_arch_data_model 64 - + @@ -237,7 +237,7 @@ Automatically start I2P in the background - + diff --git a/installer/resources/install_i2p_service_winnt.bat b/installer/resources/install_i2p_service_winnt.bat index 5fe310680..46804a55f 100644 --- a/installer/resources/install_i2p_service_winnt.bat +++ b/installer/resources/install_i2p_service_winnt.bat @@ -25,6 +25,8 @@ set _WRAPPER_CONF="%~f1" if not %_WRAPPER_CONF%=="" goto startup set _WRAPPER_CONF="%_REALPATH%wrapper.config" +call "%_REALPATH%"\set_config_dir_for_nt_service.bat install + rem rem Install the Wrapper as an NT service. rem @@ -32,7 +34,7 @@ rem :: We remove the existing service to :: 1) force the service to stop :: 2) update service configuration in case wrapper.config was edited -:: 3) prevent hanging the installer if 'install as service' is selected +:: 3) prevent hanging the installer if 'install as service' is selected :: and it's already enabled as a service. "%_WRAPPER_EXE%" -r %_WRAPPER_CONF% "%_WRAPPER_EXE%" -i %_WRAPPER_CONF% diff --git a/installer/resources/set_config_dir_for_nt_service.bat b/installer/resources/set_config_dir_for_nt_service.bat index adbabdad7..1c4e5b337 100644 --- a/installer/resources/set_config_dir_for_nt_service.bat +++ b/installer/resources/set_config_dir_for_nt_service.bat @@ -1,4 +1,18 @@ @echo off +rem %~dp0 is location of current script under NT +set _REALPATH=%~dp0 +set _WRAPPER_CONF="%_REALPATH%wrapper.config" + cd /d %~dp0 -echo. -echo wrapper.java.additional.5=-Di2p.dir.config="%APPDATA%\i2p">>wrapper.config +if "%1"=="uninstall" ( + FINDSTR /I /v "^wrapper.java.additional.5=-Di2p.dir.config=" %_WRAPPER_CONF% >> %_WRAPPER_CONF%.new + move %_WRAPPER_CONF%.new %_WRAPPER_CONF% + goto end +) 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%\Application Data\i2p" >> %_WRAPPER_CONF% + goto end +) + +:end diff --git a/installer/resources/shortcutSpec.xml b/installer/resources/shortcutSpec.xml index d95fc5b70..fac66f88d 100644 --- a/installer/resources/shortcutSpec.xml +++ b/installer/resources/shortcutSpec.xml @@ -1,6 +1,16 @@ +