Commit b2c40fce authored by gabime's avatar gabime

Fixed issue #156 (use stat to check file existance under osx as well(

parent 43a4048b
...@@ -176,18 +176,9 @@ inline bool file_exists(const filename_t& filename) ...@@ -176,18 +176,9 @@ inline bool file_exists(const filename_t& filename)
auto attribs = GetFileAttributesA(filename.c_str()); auto attribs = GetFileAttributesA(filename.c_str());
#endif #endif
return (attribs != INVALID_FILE_ATTRIBUTES && !(attribs & FILE_ATTRIBUTE_DIRECTORY)); return (attribs != INVALID_FILE_ATTRIBUTES && !(attribs & FILE_ATTRIBUTE_DIRECTORY));
#elif __linux__ #else //common linux/unix all have the stat system call
struct stat buffer; struct stat buffer;
return (stat (filename.c_str(), &buffer) == 0); 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 #endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment