Check persistent cache directory

This commit is contained in:
Andrea Cavalli 2022-06-09 16:47:42 +02:00
parent 957866ec99
commit 8578facfe7
1 changed files with 14 additions and 0 deletions

View File

@ -861,6 +861,20 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
} else {
databasesDirPath = null;
}
//noinspection ConstantConditions
if (databaseOptions.persistentCaches() != null) {
for (var persistentCache : databaseOptions.persistentCaches()) {
var persistentCachePath = Paths.get(persistentCache.path());
if (Files.notExists(persistentCachePath)) {
Files.createDirectories(persistentCachePath);
if (!Files.isDirectory(persistentCachePath)) {
throw new IllegalArgumentException(
"Persistent cache \"" + persistentCache.id() + "\" path \"" + persistentCachePath
+ "\" is not a directory!");
}
}
}
}
// the Options class contains a set of configurable DB options
// that determines the behaviour of the database.