-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use std::filesystem::path
for Path
#9205
Comments
We already have |
@edolstra I would say they are both useful but for different purposes:
I started slogging away at a branch for this issue, and I made a |
Re: (2) the LLFIO Re: stability, I don't think LEWG made a single change last meeting which affected the code, not even renaming. |
@ned14 Thanks for chiming in here. While yes |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-11-17-nix-team-meeting-minutes-104/35753/1 |
As discussed in the last Nix team meeting (2024-02-95), this method doesn't belong because `CanonPath` is a virtual/ideal absolute path format, not used in file systems beyond the native OS format for which a "current working directory" is defined. Progress towards NixOS#9205
As discussed in the last Nix team meeting (2024-02-95), this method doesn't belong because `CanonPath` is a virtual/ideal absolute path format, not used in file systems beyond the native OS format for which a "current working directory" is defined. Progress towards NixOS#9205
As discussed in the last Nix team meeting (2024-02-95), this method doesn't belong because `CanonPath` is a virtual/ideal absolute path format, not used in file systems beyond the native OS format for which a "current working directory" is defined. Progress towards NixOS#9205
As discussed in the last Nix team meeting (2024-02-95), this method doesn't belong because `CanonPath` is a virtual/ideal absolute path format, not used in file systems beyond the native OS format for which a "current working directory" is defined. Progress towards NixOS#9205
As discussed in the last Nix team meeting (2024-02-95), this method doesn't belong because `CanonPath` is a virtual/ideal absolute path format, not used in file systems beyond the native OS format for which a "current working directory" is defined. Progress towards NixOS#9205
@Ericson2314 I tried to create symlinks on Windows using MinGW but it fails for files and also directories so instead this worked:
And playing with
I'll provide a branch with unit tests for inspiration soon. |
@qknight Great! Since I am hopefully a GSOC project will be picking up this issue (freeing us to work on other things), starting with a bunch of unit tests is an excellent first step. |
In 508e762 i implemented:
which both use std::filesystem and are wrapped in i only tested them using
future testsi would wish for
|
We should also have tests covering these requirements:
|
Progress on #9205 Co-Authored-By: John Ericson <[email protected]> * Get rid of `PathNG`, just use `std::filesystem::path`
I would agree about copy and xcopy. I don't agree about robocopy, which was written by an experienced NT kernel developer precisely because all the other tools had issues. I've never found anything possible on a NT filesystem robocopy can't be persuaded to handle, though it may take non-obvious options. It doesn't use the same copying semantics as POSIX Where robocopy does fall down somewhat is large directories - it isn't quick at deleting a 100 million item directory. A LLFIO based tool can clear that in under ten seconds, robocopy can take lots of minutes. I also really don't like |
Progress on NixOS#9205 Co-Authored-By: John Ericson <[email protected]> * Get rid of `PathNG`, just use `std::filesystem::path`
This ended up motivating a good deal of other infra improvements in order to get Windows right: - `OsString` to complement `std::filesystem::path` - env var code for working with the underlying `OsString`s - Rename `PATHNG_LITERAL` to `OS_STR` - `NativePathTrait` renamed to `OsPathTrait`, given a character template parameter until NixOS#9205 is complete. Split `tests.cc` matching split of `util.{cc,hh}` last year. Robert Hensing <[email protected]>
This ended up motivating a good deal of other infra improvements in order to get Windows right: - `OsString` to complement `std::filesystem::path` - env var code for working with the underlying `OsString`s - Rename `PATHNG_LITERAL` to `OS_STR` - `NativePathTrait` renamed to `OsPathTrait`, given a character template parameter until NixOS#9205 is complete. Split `tests.cc` matching split of `util.{cc,hh}` last year. Robert Hensing <[email protected]>
This ended up motivating a good deal of other infra improvements in order to get Windows right: - `OsString` to complement `std::filesystem::path` - env var code for working with the underlying `OsString`s - Rename `PATHNG_LITERAL` to `OS_STR` - `NativePathTrait` renamed to `OsPathTrait`, given a character template parameter until NixOS#9205 is complete. Split `tests.cc` matching split of `util.{cc,hh}` last year. Co-authored-by: Robert Hensing <[email protected]>
We currently have
Path
defined asstd::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:std::filesystem::path_view
.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 ourSourcePath
VFS we want almost all file access to go though. That meansstd::filesystem::path
is just used for the lower level glue code with the OS.The text was updated successfully, but these errors were encountered: