-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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::readDirectory
and remove it
#10684
Conversation
`nix::readDirectory` is removed. `std::filesystem::directory_iterator` is used directly in places that used this util.
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.
Looks good apart from the test failure.
Can you resolve the conflicts? Then we can merge this. |
nix::readDirectory
and remove it. nix::readDirectory
and remove it
@siddhantk232 can you make sure ever for loop callsite has a "check interrupt" like before? This will make sure we don't regress with control-C support and very wide directories. |
Thanks for pointing this out! I'll open another PR that does this. |
if (entries.size() == 1) | ||
tmpFile = entries[0].path(); | ||
auto entries = std::filesystem::directory_iterator{unpacked}; | ||
auto file_count = std::distance(entries, std::filesystem::directory_iterator{}); |
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.
This broke the prefetch command if unpack is used. Fixed in #11051
auto entries = readDirectory(out); | ||
if (entries.size() != 1) | ||
auto entries = std::filesystem::directory_iterator{out}; | ||
auto fileName = entries->path().string(); |
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.
Maybe this way around it actually works.
nix::readDirectory
is removed.std::filesystem::directory_iterator
is used directly in places that used this util.Motivation
The
nix::readDirectory
usesstd::filesystem::directory_iterator
and pushes all the entries in astd::vector
before returning it. This is redundant as we can directly usestd::filesystem::directory_iterator
to iterate through entries and count files (and dirs) in path.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.