mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-14 04:13:14 -04:00
Added option to clean odb folders on startup
Change 0 to 1 to enable this feature in options.cfg
This commit is contained in:
+4
-1
@@ -1,3 +1,6 @@
|
||||
LOAD.SNAPSHOT_OBJECTS=1
|
||||
LOAD.BUILDOUT_OBJECTS=1
|
||||
LOAD.RESOURCE.SYSTEM=1
|
||||
LOAD.RESOURCE.SYSTEM=1
|
||||
|
||||
# Misc
|
||||
CLEAN.ODB.FOLDERS=0
|
||||
@@ -21,6 +21,7 @@
|
||||
******************************************************************************/
|
||||
package main;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@@ -256,6 +257,21 @@ public class NGECore {
|
||||
options.setFilePath("options.cfg");
|
||||
boolean optionsConfigLoaded = options.loadConfigFile();
|
||||
|
||||
if (optionsConfigLoaded && options.getInt("CLEAN.ODB.FOLDERS") > 0) {
|
||||
File baseFolder = new File("./odb");
|
||||
|
||||
if (baseFolder.isDirectory()) {
|
||||
for (File odbFolder : baseFolder.listFiles()) {
|
||||
if (odbFolder.isDirectory()) {
|
||||
for (File file : odbFolder.listFiles()) {
|
||||
if (!file.isDirectory() && !file.getName().equals("placeholder.txt")) { file.delete(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("Cleaned ODB Folders.");
|
||||
}
|
||||
|
||||
// Database
|
||||
databaseConnection = new DatabaseConnection();
|
||||
databaseConnection.connect(config.getString("DB.URL"), config.getString("DB.NAME"), config.getString("DB.USER"), config.getString("DB.PASS"), "postgresql");
|
||||
|
||||
Reference in New Issue
Block a user