-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
We currently have Path defined as std::string. This is kinda sloppy in general, but especially bad if we ever want to work on Windows.
We should instead use std::filesystem::path, which is the newish C++ standard Path type, and which does all the right things on all platforms.
Unfortunately, there isn't yet a std::filesystem::path_view. cplusplus/papers#406 will eventually fix this, but it is not yet stable and won't be for a while. This gives us two choices:
- Use https://github.com/ned14/llfio, which is pioneering what will hopefully be standardized as
std::filesystem::path_view. - Hand-roll our own
PathView, which can be a small convenience aroundstd::basic_string_view<Path::value_type>that has the missing implicit coercions.
I think (2) is the better first step; we can easily got from (2) to (1) later if we want.
Also per what @edolstra says before CanonPath should not change and we should also use it more. It would be for "internal" paths / paths in our SourcePath VFS we want almost all file access to go though. That means std::filesystem::path is just used for the lower level glue code with the OS.