From 4986f525f6e9df8f7f2a97d80ca852f71b367891 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sun, 13 Apr 2025 17:07:19 +0100 Subject: [PATCH] db: create data dir if it's not present --- src/core/Db.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/Db.cpp b/src/core/Db.cpp index 5da5058..377d945 100644 --- a/src/core/Db.cpp +++ b/src/core/Db.cpp @@ -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"));