mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-01-09 14:27:10 +00:00
use binary dir paths, create ones that dont exist, do not run if critical ones do not exist.
This commit is contained in:
parent
2560bb00da
commit
b2af3fa9d4
@ -1,5 +1,5 @@
|
|||||||
PROJECT_VERSION_MAJOR=2
|
PROJECT_VERSION_MAJOR=3
|
||||||
PROJECT_VERSION_MINOR=3
|
PROJECT_VERSION_MINOR=0
|
||||||
PROJECT_VERSION_PATCH=0
|
PROJECT_VERSION_PATCH=0
|
||||||
|
|
||||||
# Debugging
|
# Debugging
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "dConfig.h"
|
#include "dConfig.h"
|
||||||
#include "Logger.h"
|
#include "Logger.h"
|
||||||
#include "dPlatforms.h"
|
#include "dPlatforms.h"
|
||||||
|
#include "BinaryPathFinder.h"
|
||||||
|
|
||||||
// Static Variables
|
// Static Variables
|
||||||
|
|
||||||
@ -17,7 +18,14 @@ namespace {
|
|||||||
void SQLiteDatabase::Connect() {
|
void SQLiteDatabase::Connect() {
|
||||||
LOG("Using SQLite database");
|
LOG("Using SQLite database");
|
||||||
con = new CppSQLite3DB();
|
con = new CppSQLite3DB();
|
||||||
con->open(Game::config->GetValue("sqlite_database_path").c_str());
|
const auto path = BinaryPathFinder::GetBinaryDir() / Game::config->GetValue("sqlite_database_path");
|
||||||
|
|
||||||
|
if (!std::filesystem::exists(path)) {
|
||||||
|
LOG("Creating sqlite path %s", path.string().c_str());
|
||||||
|
std::filesystem::create_directories(path.parent_path());
|
||||||
|
}
|
||||||
|
|
||||||
|
con->open(path.string().c_str());
|
||||||
isConnected = true;
|
isConnected = true;
|
||||||
|
|
||||||
// Make sure wal is enabled for the database.
|
// Make sure wal is enabled for the database.
|
||||||
|
@ -84,6 +84,15 @@ int main(int argc, char** argv) {
|
|||||||
Server::SetupLogger("MasterServer");
|
Server::SetupLogger("MasterServer");
|
||||||
if (!Game::logger) return EXIT_FAILURE;
|
if (!Game::logger) return EXIT_FAILURE;
|
||||||
|
|
||||||
|
auto folders = { "navmeshes", "migrations", "vanity" };
|
||||||
|
|
||||||
|
for (const auto folder : folders) {
|
||||||
|
if (!std::filesystem::exists(BinaryPathFinder::GetBinaryDir() / folder)) {
|
||||||
|
LOG("The %s folder was not copied to the binary directory. Please copy the %s folder from your download to the binary directory or re-run cmake.", folder, folder);
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!dConfig::Exists("authconfig.ini")) LOG("Could not find authconfig.ini, using default settings");
|
if (!dConfig::Exists("authconfig.ini")) LOG("Could not find authconfig.ini, using default settings");
|
||||||
if (!dConfig::Exists("chatconfig.ini")) LOG("Could not find chatconfig.ini, using default settings");
|
if (!dConfig::Exists("chatconfig.ini")) LOG("Could not find chatconfig.ini, using default settings");
|
||||||
if (!dConfig::Exists("masterconfig.ini")) LOG("Could not find masterconfig.ini, using default settings");
|
if (!dConfig::Exists("masterconfig.ini")) LOG("Could not find masterconfig.ini, using default settings");
|
||||||
|
Loading…
Reference in New Issue
Block a user