Adding more control over data directory path

Former-commit-id: 926b9f3d2ed0a19a28a3d23a64bada70b5da22a6
This commit is contained in:
Steve Springett
2013-05-27 00:10:08 -07:00
parent 172a341b40
commit 7c78283b46
5 changed files with 15 additions and 39 deletions

View File

@@ -58,15 +58,7 @@ public abstract class BaseIndexTestCase {
protected static File getDataDirectory() throws IOException {
String fileName = Settings.getString(Settings.KEYS.CPE_INDEX);
File exePath = FileUtils.getDataDirectory(fileName, Index.class);
if (exePath.getName().toLowerCase().endsWith(".jar")) {
exePath = exePath.getParentFile();
} else {
exePath = new File(".");
}
File path = new File(exePath.getCanonicalFile() + File.separator + fileName);
path = new File(path.getCanonicalPath());
return path;
return FileUtils.getDataDirectory(fileName, Index.class);
}
public static void ensureIndexExists() throws Exception {

View File

@@ -49,15 +49,7 @@ public abstract class BaseDBTestCase extends TestCase {
protected static File getDataDirectory() throws IOException {
String fileName = Settings.getString(Settings.KEYS.CVE_INDEX);
File exePath = FileUtils.getDataDirectory(fileName, Index.class);
if (exePath.getName().toLowerCase().endsWith(".jar")) {
exePath = exePath.getParentFile();
} else {
exePath = new File(".");
}
File path = new File(exePath.getCanonicalFile() + File.separator + fileName);
path = new File(path.getCanonicalPath());
return path;
return FileUtils.getDataDirectory(fileName, Index.class);
}
public static void ensureDBExists() throws Exception {