Commit 93f45904 authored by Max Kellermann's avatar Max Kellermann

system/Error: add IsFileNotFound()

parent 1098d271
......@@ -31,6 +31,7 @@
#define SYSTEM_ERROR_HXX
#include "util/StringUtil.hxx"
#include "Compiler.h"
#include <system_error>
#include <utility>
......@@ -106,4 +107,17 @@ FormatErrno(const char *fmt, Args&&... args)
#endif
gcc_pure
static inline bool
IsFileNotFound(const std::system_error &e)
{
#ifdef WIN32
return e.code().category() == std::system_category() &&
e.code().value() == ERROR_FILE_NOT_FOUND;
#else
return e.code().category() == std::system_category() &&
e.code().value() == ENOENT;
#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