1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 10:31:15 +02:00

create pathAccessible, use it to infer default dirs

This commit is contained in:
Yorick van Pelt 2023-05-26 15:32:28 +02:00
parent a6c78ba367
commit 2c462486fe
No known key found for this signature in database
GPG key ID: D8D3CC6D951384DE
5 changed files with 26 additions and 14 deletions

View file

@ -266,6 +266,17 @@ bool pathExists(const Path & path)
return false;
}
bool pathAccessible(const Path & path)
{
try {
return pathExists(path);
} catch (SysError & e) {
// swallow EPERM
if (e.errNo == EPERM) return false;
throw;
}
}
Path readLink(const Path & path)
{