gulrak / filesystem

An implementation of C++17 std::filesystem for C++11 /C++14/C++17/C++20 on Windows, macOS, Linux and FreeBSD.
MIT License
1.34k stars 173 forks source link

Use ghc::filesystem as a substitute for std::filesystem transparently? #180

Open kencu opened 6 months ago

kencu commented 6 months ago

Is there some way that a build written to use std::filesystem:: calls might transparently substitute ghc::filesystem:: calls without patching the code?

gulrak commented 6 months ago

If the calling code is already build, in other words for a binary, that is impossible, as it is not link compatible, also formally the standard doesn't allow putting own stuff into the std namespace (besides template specializations like for e.g. std::swap), so while there might be hacks to get there (maybe using the required types inside of a std namespace) it is undefined behavior and thus not an option in the scope of this project. Additionally the documented differences might come into play if the code depends on exact behavior.