diff options
author | Max Kellermann <max@musicpd.org> | 2019-12-04 12:31:38 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2019-12-04 12:33:38 +0100 |
commit | ce093be12c4f2c6aab20774b1b4a10cf206b8e35 (patch) | |
tree | 7829a791ad949005b3aea4fd0168d3dd0915f8b7 /src | |
parent | 2c276770f0687a916719f68bde81bb134547488f (diff) |
system/Error: add FormatFileNotFound()
Diffstat (limited to 'src')
-rw-r--r-- | src/system/Error.hxx | 12 |
1 files changed, 12 insertions, 0 deletions
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>(args)...); } +template<typename... Args> +static inline std::system_error +FormatFileNotFound(const char *fmt, Args&&... args) noexcept +{ +#ifdef _WIN32 + return FormatLastError(ERROR_FILE_NOT_FOUND, fmt, + std::forward<Args>(args)...); +#else + return FormatErrno(ENOENT, fmt, std::forward<Args>(args)...); +#endif +} + gcc_pure inline bool IsErrno(const std::system_error &e, int code) noexcept |