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;
|
this.dbDir = dbDir;
|
||||||
EventBus.getInstance().registerListener(this);
|
EventBus.getInstance().registerListener(this);
|
||||||
|
|
||||||
// Test if the database directory is actually a directory
|
// Ensure that the database directory exists
|
||||||
if (dbDir.exists() && !dbDir.isDirectory())
|
if (!dbDir.exists()) {
|
||||||
|
dbDir.mkdirs();
|
||||||
|
} else if (!dbDir.isDirectory())
|
||||||
throw new IOException(String.format("LocalDBDir '%s' is not a directory!", dbDir.getAbsolutePath()));
|
throw new IOException(String.format("LocalDBDir '%s' is not a directory!", dbDir.getAbsolutePath()));
|
||||||
|
|
||||||
|
|
||||||
// Initialize global files
|
// Initialize global files
|
||||||
idGeneratorFile = new File(dbDir, "id_gen.db");
|
idGeneratorFile = new File(dbDir, "id_gen.db");
|
||||||
lastLoginFile = new File(dbDir, "last_login.db");
|
lastLoginFile = new File(dbDir, "last_login.db");
|
||||||
|
Reference in New Issue
Block a user