1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-10 12:36:01 +01:00

Merge pull request #13122 from Mic92/directory-iterator

Replace all instances of std::filesystem::directory_iterator with DirectoryIterator
This commit is contained in:
Jörg Thalheim 2025-05-01 14:22:21 +02:00 committed by GitHub
commit 143fb88ceb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 164 additions and 64 deletions

View file

@ -244,14 +244,13 @@ StringSet NixRepl::completePrefix(const std::string & prefix)
try {
auto dir = std::string(cur, 0, slash);
auto prefix2 = std::string(cur, slash + 1);
for (auto & entry : std::filesystem::directory_iterator{dir == "" ? "/" : dir}) {
for (auto & entry : DirectoryIterator{dir == "" ? "/" : dir}) {
checkInterrupt();
auto name = entry.path().filename().string();
if (name[0] != '.' && hasPrefix(name, prefix2))
completions.insert(prev + entry.path().string());
}
} catch (Error &) {
} catch (std::filesystem::filesystem_error &) {
}
} else if ((dot = cur.rfind('.')) == std::string::npos) {
/* This is a variable name; look it up in the current scope. */