Adding more control over data directory path

Former-commit-id: 263475fc5b3aae04f2530ea78a0456deb18686fe
This commit is contained in:
Steve Springett
2013-05-27 00:10:08 -07:00
parent 9a7fbe44eb
commit dbc862ad39
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 {