forked from I2P_Developers/i2p.i2p
Fix: Wrong working dir when running as a Windows service
This commit is contained in:
@@ -408,6 +408,7 @@
|
|||||||
<copy file="installer/resources/fixperms.bat" todir="pkg-temp/" />
|
<copy file="installer/resources/fixperms.bat" todir="pkg-temp/" />
|
||||||
<copy file="installer/resources/install_i2p_service_winnt.bat" todir="pkg-temp/" />
|
<copy file="installer/resources/install_i2p_service_winnt.bat" todir="pkg-temp/" />
|
||||||
<copy file="installer/resources/postinstall.bat" todir="pkg-temp/" />
|
<copy file="installer/resources/postinstall.bat" todir="pkg-temp/" />
|
||||||
|
<copy file="installer/resources/set_config_dir_for_nt_service.bat" todir="pkg-temp/" />
|
||||||
<copy file="installer/resources/uninstall_i2p_service_winnt.bat" todir="pkg-temp/" />
|
<copy file="installer/resources/uninstall_i2p_service_winnt.bat" todir="pkg-temp/" />
|
||||||
<copy todir="pkg-temp/lib/wrapper/win32/">
|
<copy todir="pkg-temp/lib/wrapper/win32/">
|
||||||
<fileset dir="installer/lib/wrapper/win32/" />
|
<fileset dir="installer/lib/wrapper/win32/" />
|
||||||
|
@@ -183,8 +183,8 @@
|
|||||||
<pack name="Windows Service" required="no">
|
<pack name="Windows Service" required="no">
|
||||||
<description>Automatically start I2P in the background</description>
|
<description>Automatically start I2P in the background</description>
|
||||||
<os family="windows" />
|
<os family="windows" />
|
||||||
|
<executable targetfile="$INSTALL_PATH/set_config_dir_for_nt_service.bat" stage="postinstall" failure="warn" keep="false" />
|
||||||
<!--
|
<!--
|
||||||
<executable targetfile="$INSTALL_PATH/install_i2p_service_winnt.bat" stage="postinstall" failure="warn" keep="true" />
|
|
||||||
-->
|
-->
|
||||||
<executable targetfile="$INSTALL_PATH/install_i2p_service_winnt.bat" stage="postinstall" failure="warn" keep="true">
|
<executable targetfile="$INSTALL_PATH/install_i2p_service_winnt.bat" stage="postinstall" failure="warn" keep="true">
|
||||||
<args>
|
<args>
|
||||||
@@ -198,9 +198,6 @@
|
|||||||
<arg value="$INSTALL_PATH\wrapper.config" />
|
<arg value="$INSTALL_PATH\wrapper.config" />
|
||||||
</args>
|
</args>
|
||||||
</executable>
|
</executable>
|
||||||
<!--
|
|
||||||
<executable targetfile="$INSTALL_PATH/uninstall_i2p_service_winnt.bat" stage="uninstall" failure="warn" keep="true" />
|
|
||||||
-->
|
|
||||||
<executable targetfile="$INSTALL_PATH/uninstall_i2p_service_winnt.bat" stage="uninstall" failure="warn" keep="true">
|
<executable targetfile="$INSTALL_PATH/uninstall_i2p_service_winnt.bat" stage="uninstall" failure="warn" keep="true">
|
||||||
<args>
|
<args>
|
||||||
<arg value="$INSTALL_PATH\wrapper.config" />
|
<arg value="$INSTALL_PATH\wrapper.config" />
|
||||||
|
4
installer/resources/set_config_dir_for_nt_service.bat
Normal file
4
installer/resources/set_config_dir_for_nt_service.bat
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
@echo off
|
||||||
|
cd /d %~dp0
|
||||||
|
echo.
|
||||||
|
echo wrapper.java.additional.5=-Di2p.dir.config="%APPDATA%\i2p">>wrapper.config
|
@@ -164,14 +164,22 @@ public class WorkingDir {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns <code>false</code> if a directory is empty, or contains nothing besides a subdirectory named plugins */
|
/**
|
||||||
|
* Tests if <code>dir</code> has been set up as a I2P working directory.<br/>
|
||||||
|
* Returns <code>false</code> if a directory is empty, or contains nothing besides
|
||||||
|
* subdirectories named <code>plugins</code> and/or <code>logs</code>.<br/>
|
||||||
|
* Returns <code>true</code> if the directory contains something not named
|
||||||
|
* <code>plugins</code> or <code>logs</code>.</br>
|
||||||
|
* This allows to pre-install plugins before the first router start.
|
||||||
|
*/
|
||||||
private static boolean isSetup(File dir) {
|
private static boolean isSetup(File dir) {
|
||||||
if (dir.isDirectory()) {
|
if (dir.isDirectory()) {
|
||||||
String[] files = dir.list();
|
String[] files = dir.list();
|
||||||
if (files.length == 0)
|
if (files == null)
|
||||||
return false;
|
return false;
|
||||||
if (files.length>1 || !"plugins".equals(files[0]))
|
for (String file: files)
|
||||||
return true;
|
if (!"plugins".equals(file) && !"logs".equals(file))
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user