-
-
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
inline the usage of nix::renameFile
, nix::getFileType
and nix::copyFile
#10685
Conversation
use `std::filesystem::rename` everywhere and remove `nix::renameFile`
the old `copyFile` was just a wrapper that was calling the `copy` function. This wrapper function is removed and the `copy` function is renamed to `copyFile`.
This comment was marked as off-topic.
This comment was marked as off-topic.
src/libutil/file-system.hh
Outdated
@@ -194,7 +190,7 @@ void moveFile(const Path & src, const Path & dst); | |||
* with the guaranty that the destination will be “fresh”, with no stale inode | |||
* or file descriptor pointing to it). | |||
*/ | |||
void copyFile(const Path & oldPath, const Path & newPath, bool andDelete); | |||
void copyFile(const std::filesystem::directory_entry & from, const std::filesystem::path & to, bool andDelete); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is from
a directory_entry
rather than a path
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed it to use path
instead in 62e1ea2. Not sure why it was directory_entry
before.
@@ -611,55 +605,45 @@ static void setWriteTime(const fs::path & p, const struct stat & st) | |||
} | |||
#endif | |||
|
|||
void copy(const fs::directory_entry & from, const fs::path & to, bool andDelete) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we might still want a copyEntry
function as an implementation detail because it can avoid another stat in many cases (because the directory listing already has the info).
Motivation
In order to reduce the footprint of our filesystem API, we're trying to remove existing functions with direct calls to
std::filesystem
functions.Context
#9205
Priorities and Process
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.