summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormrsmidge <smidge@xsco.net>2019-06-03 01:10:46 +0100
committermrsmidge <smidge@xsco.net>2019-06-03 01:10:46 +0100
commit6cdf066a8a137c3ff1fe8987e2a1dc23c86262de (patch)
treefc75db694ec81c887f6e4841b8412b4975e2392d /src
parent516c3b96555e8a74935e58e8345476b8f9c09be4 (diff)
Added mkdir/_mkdir switch for Windows
Diffstat (limited to 'src')
-rw-r--r--src/enginelibrary/database.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/enginelibrary/database.cpp b/src/enginelibrary/database.cpp
index f52b049..3e6118d 100644
--- a/src/enginelibrary/database.cpp
+++ b/src/enginelibrary/database.cpp
@@ -19,6 +19,9 @@
#include <string>
#include <sys/stat.h>
+#if defined(_WIN32)
+ #include <direct.h>
+#endif
#include <tuple>
#include "sqlite_modern_cpp.h"
@@ -152,7 +155,11 @@ database create_database(const std::string &dir_path,
if (stat(dir_path.c_str(), &buf) != 0)
{
// Create the dir
+#if defined(_WIN32)
+ if (_mkdir(dir_path.c_str()) != 0)
+#else
if (mkdir(dir_path.c_str(), 0755) != 0)
+#endif
{
throw std::runtime_error{
"Failed to create directory to hold new database"};