From f430f30b769dd2be3a126ca235529e34d420cb02 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Fri, 19 Jul 2024 16:27:17 -0700 Subject: [PATCH] Fix weaklyCanonicalFileWithSuffix for Win11 24H2 --- stl/inc/xfilesystem_abi.h | 1 + tests/std/tests/P0218R1_filesystem/test.cpp | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/stl/inc/xfilesystem_abi.h b/stl/inc/xfilesystem_abi.h index 79ad2b6685..f11c87024c 100644 --- a/stl/inc/xfilesystem_abi.h +++ b/stl/inc/xfilesystem_abi.h @@ -53,6 +53,7 @@ _NODISCARD inline bool __std_is_file_not_found(const __std_win_error _Error) noe case __std_win_error::_Path_not_found: case __std_win_error::_Error_bad_netpath: case __std_win_error::_Invalid_name: + case __std_win_error::_Directory_name_is_invalid: // Windows 11 24H2 return true; default: return false; diff --git a/tests/std/tests/P0218R1_filesystem/test.cpp b/tests/std/tests/P0218R1_filesystem/test.cpp index c7907450e4..9a26c8f048 100644 --- a/tests/std/tests/P0218R1_filesystem/test.cpp +++ b/tests/std/tests/P0218R1_filesystem/test.cpp @@ -3950,7 +3950,7 @@ void test_devcom_953628() { // COMPILE-ONLY path{S{}}; } -int wmain(int argc, wchar_t* argv[]) { +int run_all_tests(int argc, wchar_t* argv[]) { error_code ec; // Store old path and change current path to a temporary path @@ -4077,4 +4077,20 @@ int wmain(int argc, wchar_t* argv[]) { EXPECT(good(ec)); assert(pass); + + return 0; +} + +int wmain(int argc, wchar_t* argv[]) { + try { + return run_all_tests(argc, argv); + } catch (const filesystem_error& fe) { + cout << "filesystem_error: " << fe.what() << endl; + } catch (const exception& e) { + cout << "exception: " << e.what() << endl; + } catch (...) { + cout << "Unknown exception." << endl; + } + + return EXIT_FAILURE; }