From b2c40fcedff27407dc285f21f27e0af15a73402a Mon Sep 17 00:00:00 2001 From: gabime Date: Sat, 30 Jul 2016 18:23:55 +0300 Subject: [PATCH] Fixed issue #156 (use stat to check file existance under osx as well( --- include/spdlog/details/os.h | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/include/spdlog/details/os.h b/include/spdlog/details/os.h index c43d742f..384477da 100644 --- a/include/spdlog/details/os.h +++ b/include/spdlog/details/os.h @@ -176,18 +176,9 @@ inline bool file_exists(const filename_t& filename) auto attribs = GetFileAttributesA(filename.c_str()); #endif return (attribs != INVALID_FILE_ATTRIBUTES && !(attribs & FILE_ATTRIBUTE_DIRECTORY)); -#elif __linux__ +#else //common linux/unix all have the stat system call 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 }