db: create data dir if it's not present

This commit is contained in:
Vaxry
2025-04-13 17:07:19 +01:00
parent 43f7dc4668
commit 4986f525f6

View File

@@ -39,6 +39,11 @@ static bool isHashValid(const std::string_view sv) {
}
CDatabase::CDatabase() {
if (!std::filesystem::exists(dbDir())) {
Debug::log(LOG, "Data dir doesn't exist, creating.");
std::filesystem::create_directory(dbDir());
}
if (std::filesystem::exists(dbPath())) {
if (std::filesystem::exists(dbDir() + "/schema")) {
int schema = std::stoi(readFileAsText(dbDir() + "/schema"));