From d3c0ec5651aa224908618efb555f897b995b477c Mon Sep 17 00:00:00 2001 From: Elad <18193363+elad335@users.noreply.github.com> Date: Sat, 2 Nov 2024 13:34:51 +0200 Subject: [PATCH] Print last system error on fs::error::unknown --- Utilities/File.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Utilities/File.cpp b/Utilities/File.cpp index 89d53f9407..7426529e26 100644 --- a/Utilities/File.cpp +++ b/Utilities/File.cpp @@ -2639,6 +2639,17 @@ void fmt_class_string::format(std::string& out, u64 arg) template<> void fmt_class_string::format(std::string& out, u64 arg) { + if (arg == static_cast(fs::error::unknown)) + { + // Note: may not be the correct error code because it only prints the last +#ifdef _WIN32 + fmt::append(out, "Unknown error [errno=%d]", GetLastError()); +#else + fmt::append(out, "Unknown error [errno=%d]", errno); +#endif + return; + } + format_enum(out, arg, [](auto arg) { switch (arg)