Initialize local database directory during startup
This commit is contained in:
parent
fd21c5789f
commit
a8aa1c9ea7
@ -53,10 +53,13 @@ public final class LocalDB implements EventListener {
|
||||
this.dbDir = dbDir;
|
||||
EventBus.getInstance().registerListener(this);
|
||||
|
||||
// Test if the database directory is actually a directory
|
||||
if (dbDir.exists() && !dbDir.isDirectory())
|
||||
// Ensure that the database directory exists
|
||||
if (!dbDir.exists()) {
|
||||
dbDir.mkdirs();
|
||||
} else if (!dbDir.isDirectory())
|
||||
throw new IOException(String.format("LocalDBDir '%s' is not a directory!", dbDir.getAbsolutePath()));
|
||||
|
||||
|
||||
// Initialize global files
|
||||
idGeneratorFile = new File(dbDir, "id_gen.db");
|
||||
lastLoginFile = new File(dbDir, "last_login.db");
|
||||
|
Reference in New Issue
Block a user