From 7fb7259b3b300bb261c007716983cccc57316bf6 Mon Sep 17 00:00:00 2001 From: x86kernel Date: Thu, 31 Dec 2015 11:23:26 +0000 Subject: [PATCH] no chdir2 --- include/spdlog/details/file_helper.h | 3 ++- include/spdlog/details/os.h | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/spdlog/details/file_helper.h b/include/spdlog/details/file_helper.h index d7dcdbc8..88a46e16 100644 --- a/include/spdlog/details/file_helper.h +++ b/include/spdlog/details/file_helper.h @@ -215,7 +215,8 @@ public: if(r) { #ifdef _WIN32 - //not yet + if(os::get_lasterror() != ERROR_ALREADY_EXISTS) + return r; #else if(os::get_lasterror() != EEXIST) return r; diff --git a/include/spdlog/details/os.h b/include/spdlog/details/os.h index f9087862..8cc8d88e 100644 --- a/include/spdlog/details/os.h +++ b/include/spdlog/details/os.h @@ -133,7 +133,7 @@ constexpr inline unsigned short eol_size() inline int get_lasterror() { #ifdef _WIN32 - //not yet + return GetLastError(); #else return errno; #endif @@ -142,7 +142,7 @@ inline int get_lasterror() inline bool _mkdir(const std::string& dirname) { #ifdef _WIN32 - //not yet + return CreateDirectoryA(dirname.c_str(), NULL) == 0; #else return mkdir(dirname.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); #endif