Fix: Wrong working dir when running as a Windows service

This commit is contained in:
HungryHobo
2011-03-27 01:30:30 +00:00
parent 4fbde3a0bc
commit 0617ee99cd
4 changed files with 18 additions and 8 deletions

View File

@@ -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) {
if (dir.isDirectory()) {
String[] files = dir.list();
if (files.length == 0)
if (files == null)
return false;
if (files.length>1 || !"plugins".equals(files[0]))
return true;
for (String file: files)
if (!"plugins".equals(file) && !"logs".equals(file))
return true;
}
return false;
}