diff --git a/src/system/Error.hxx b/src/system/Error.hxx index a22c3ba29..5027e6864 100644 --- a/src/system/Error.hxx +++ b/src/system/Error.hxx @@ -147,6 +147,18 @@ FormatErrno(const char *fmt, Args&&... args) noexcept return FormatErrno(errno, fmt, std::forward(args)...); } +template +static inline std::system_error +FormatFileNotFound(const char *fmt, Args&&... args) noexcept +{ +#ifdef _WIN32 + return FormatLastError(ERROR_FILE_NOT_FOUND, fmt, + std::forward(args)...); +#else + return FormatErrno(ENOENT, fmt, std::forward(args)...); +#endif +} + gcc_pure inline bool IsErrno(const std::system_error &e, int code) noexcept