diff --git a/configure.ac b/configure.ac index 35270ccca..50e8cd93f 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.63]) -AC_INIT([leech], [0.1.11], [https://github.com/larsewi/leech/issues], [leech], +AC_INIT([leech], [0.1.12], [https://github.com/larsewi/leech/issues], [leech], [https://github.com/larsewi/leech]) AC_CONFIG_SRCDIR([lib/leech.h]) diff --git a/lib/files.c b/lib/files.c index 863b27aa4..4a4a39222 100644 --- a/lib/files.c +++ b/lib/files.c @@ -9,6 +9,10 @@ #include #include +#ifdef _WIN32 +#include +#endif // _WIN32 + #include "definitions.h" #include "logger.h" #include "string_lib.h" @@ -141,7 +145,13 @@ bool LCH_FileCreateParentDirectories(const char *const filename) { const size_t num_dirs = LCH_ListLength(dirs); for (size_t i = num_dirs; i > 0; i--) { char *const dir = (char *)LCH_ListGet(dirs, i - 1); - if (mkdir(dir, (mode_t)0700) == -1) { + int ret = +#ifdef _WIN32 + _mkdir(dir); +#else // _WIN32 + mkdir(dir, (mode_t)0700); +#endif // _WIN32 + if (ret == -1) { LCH_LOG_ERROR("Failed to create parent directory '%s' for file '%s': %s", dir, filename, strerror(errno)); LCH_ListDestroy(dirs);