mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
create pathAccessible, use it to infer default dirs
This commit is contained in:
parent
a6c78ba367
commit
2c462486fe
5 changed files with 26 additions and 14 deletions
|
@ -2620,17 +2620,12 @@ Strings EvalSettings::getDefaultNixPath()
|
|||
{
|
||||
Strings res;
|
||||
auto add = [&](const Path & p, const std::string & s = std::string()) {
|
||||
try {
|
||||
if (pathExists(p)) {
|
||||
if (s.empty()) {
|
||||
res.push_back(p);
|
||||
} else {
|
||||
res.push_back(s + "=" + p);
|
||||
}
|
||||
if (pathAccessible(p)) {
|
||||
if (s.empty()) {
|
||||
res.push_back(p);
|
||||
} else {
|
||||
res.push_back(s + "=" + p);
|
||||
}
|
||||
} catch (SysError & e) {
|
||||
// swallow EPERM
|
||||
if (e.errNo != EPERM) throw;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue