system/Error: add IsFileNotFound()
This commit is contained in:
parent
1098d271b8
commit
93f4590453
@ -31,6 +31,7 @@
|
|||||||
#define SYSTEM_ERROR_HXX
|
#define SYSTEM_ERROR_HXX
|
||||||
|
|
||||||
#include "util/StringUtil.hxx"
|
#include "util/StringUtil.hxx"
|
||||||
|
#include "Compiler.h"
|
||||||
|
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@ -106,4 +107,17 @@ FormatErrno(const char *fmt, Args&&... args)
|
|||||||
|
|
||||||
#endif
|
#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
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user