1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 07:22:43 +01:00

Merge pull request #12667 from NixOS/in-dir-cleanup

Cleanup `isInDir` and  `isDirOrInDir`
This commit is contained in:
John Ericson 2025-03-19 18:01:59 -04:00 committed by GitHub
commit 3d333e0aff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 16 additions and 18 deletions

View file

@ -245,7 +245,7 @@ void LocalStore::findRoots(const Path & path, std::filesystem::file_type type, R
else {
target = absPath(target, dirOf(path));
if (!pathExists(target)) {
if (isInDir(path, stateDir + "/" + gcRootsDir + "/auto")) {
if (isInDir(path, std::filesystem::path{stateDir.get()} / gcRootsDir / "auto")) {
printInfo("removing stale link from '%1%' to '%2%'", path, target);
unlink(path.c_str());
}

View file

@ -1046,7 +1046,7 @@ void LocalDerivationGoal::startBuilder()
/* If only we had a trie to do this more efficiently :) luckily, these are generally going to be pretty small */
for (auto & a : allowedPaths) {
Path canonA = canonPath(a);
if (canonI == canonA || isInDir(canonI, canonA)) {
if (isDirOrInDir(canonI, canonA)) {
found = true;
break;
}