mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
* nix-env: a tool to manage user environments.
* Replace all directory reading code by a generic readDirectory() function.
This commit is contained in:
parent
fd7ac09f10
commit
9898746ef3
16 changed files with 412 additions and 51 deletions
|
@ -36,14 +36,10 @@ void checkPath(const string & path,
|
|||
throw SysError(format("getting attributes of path `%1%'") % path);
|
||||
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
AutoCloseDir dir = opendir(path.c_str());
|
||||
|
||||
struct dirent * dirent;
|
||||
while (errno = 0, dirent = readdir(dir)) {
|
||||
string name = dirent->d_name;
|
||||
if (name == "." || name == "..") continue;
|
||||
search(name, ids, seen);
|
||||
checkPath(path + "/" + name, ids, seen);
|
||||
Strings names = readDirectory(path);
|
||||
for (Strings::iterator i = names.begin(); i != names.end(); i++) {
|
||||
search(*i, ids, seen);
|
||||
checkPath(path + "/" + *i, ids, seen);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue