diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 40c74ae87ed..a4bcacd0e56 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -395,6 +395,14 @@ bool delete_directory(const std::string& path) } errno = 0; +#ifdef _WIN32 + // remove() doesn't delete directories on windows. + int (*remove)(const char*); + if(is_directory(path)) + remove = rmdir; + else + remove = ::remove; +#endif if(remove(path.c_str()) != 0) { LOG_FS << "remove(" << path << "): " << strerror(errno) << "\n"; ret = false;