Migrate to std::filesystem usage in FilePath - #2428
Conversation
|
I forgot to lint 😢 and also Windows is unhappy with some of this for whatever reason....(seems like it doesn't have an implicit conversion like the other compilers to) |
|
Code Coverage Results:
|
|
There was a Windows PR validation failure but it looks like flake rather than anything related to this PR. |
|
Is there a way to keep the |
That's exactly what I did, except for the constructor (and filepath is easily convertible to and from string so think of it as a string constructor). It was really awkward to keep the dir and file separate in this new system because it adds no meaning and forces a lot of extra checks. |
For some reason the existing one doesn't provide a good result in some Linux machines.
0347fad to
d21cf4b
Compare
open and close are "deprecated" (not really, but enough to make warnings that turn into errors)
Literal / characters do not get rewritten to native separators so Windows needs to check both since the library writes a lot of literal slashes
std::filesystem::rename passes MOVEFILE_REPLACE_EXISTING on Windows, which is known to intermittently fail with ERROR_ACCESS_DENIED right after a file is created and closed (seen on Windows Server 2022 CI runners). Retry with backoff instead of failing outright.
This leaves the FilePath interface intact and replaces its implementation with std::filesystem. This is the cleanest way to immediately eliminate legacy code using non standard C APIs to accomplish the same. As a follow up, FilePath could be removed entirely.