aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
authorYorick van Pelt <yorick@yorickvanpelt.nl>2023-05-26 15:32:28 +0200
committerYorick van Pelt <yorick@yorickvanpelt.nl>2023-05-26 15:36:47 +0200
commit2c462486fe0c1bcb5b1142507d2875e98b2418df (patch)
tree3910b99966387323f21b464f77f25b2010e915a7 /src/libexpr
parenta6c78ba367725a81aa631a7df2d0840ddd25faf5 (diff)
create pathAccessible, use it to infer default dirs
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/eval.cc15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 61012f2ab..71fd6e6e4 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -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;
}
};