}
private File getFileRoot() {
String rootPath = getInitParameter(ROOTPATH_PARAMETER);
if (rootPath == null) {
throw new WebdavException("missing parameter: " + ROOTPATH_PARAMETER);
}
if (rootPath.equals("*WAR-FILE-ROOT*")) {
String file = LocalFileSystemStore.class.getProtectionDomain().getCodeSource().getLocation().getFile().replace('\\',
'/');
if (file.charAt(0) == '/' && System.getProperty("os.name").contains("Windows")) {
file = file.substring(1, file.length());
}
int ix = file.indexOf("/WEB-INF/");
if (ix != -1) {
rootPath = file.substring(0, ix).replace('/', File.separatorChar);
} else {
throw new WebdavException("Could not determine root of war file. Can't extract from path '" + file
+ "' for this web container");
}
}
return new File(rootPath);
}