mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-26 18:41:35 +08:00
cygwin/mingw support fix
This commit is contained in:
parent
5ec7cfef63
commit
d7f1932e10
@ -148,9 +148,18 @@ inline bool file_exists(const std::string& filename)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
auto attribs = GetFileAttributesA(filename.c_str());
|
auto attribs = GetFileAttributesA(filename.c_str());
|
||||||
return (attribs != INVALID_FILE_ATTRIBUTES && !(attribs & FILE_ATTRIBUTE_DIRECTORY));
|
return (attribs != INVALID_FILE_ATTRIBUTES && !(attribs & FILE_ATTRIBUTE_DIRECTORY));
|
||||||
#else
|
#elif __linux__
|
||||||
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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user