From d7f1932e103300abb10267dad3efa8f047c0e992 Mon Sep 17 00:00:00 2001 From: gabime Date: Sun, 13 Dec 2015 12:29:19 +0200 Subject: [PATCH] cygwin/mingw support fix --- include/spdlog/details/os.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/spdlog/details/os.h b/include/spdlog/details/os.h index c814223e..ab569caa 100644 --- a/include/spdlog/details/os.h +++ b/include/spdlog/details/os.h @@ -148,9 +148,18 @@ inline bool file_exists(const std::string& filename) #ifdef _WIN32 auto attribs = GetFileAttributesA(filename.c_str()); return (attribs != INVALID_FILE_ATTRIBUTES && !(attribs & FILE_ATTRIBUTE_DIRECTORY)); -#else +#elif __linux__ struct stat buffer; return (stat (filename.c_str(), &buffer) == 0); +#else + auto *file = fopen(filename.c_str(), "r"); + if (file != nullptr) + { + fclose(file); + return true; + } + return false; + #endif }