Replace Path String Hacks with C++17 std::filesystem
Stop treating filesystem paths as plain strings. C++17's std::filesystem offers portable path objects and directory iteration without platform-specific code.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Stop treating filesystem paths as plain strings. C++17's std::filesystem offers portable path objects and directory iteration without platform-specific code.
Problem Context The standard specifies that std::filesystem::remove throws std::filesystem_error when the removal fails. For a non‑existent path the error code is error_code::not_found, but for a file that is locked by another process the error code is implementation‑defined. The exception message derives from error_code::message(), which is system‑dependent