mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
SourceAccessor: Change the main interface from lstat() to maybeLstat()
This commit is contained in:
parent
8ffd1695ce
commit
cdb27c1519
9 changed files with 22 additions and 20 deletions
|
@ -1548,10 +1548,8 @@ static void prim_pathExists(EvalState & state, const PosIdx pos, Value * * args,
|
|||
|
||||
try {
|
||||
auto checked = state.checkSourcePath(path);
|
||||
auto exists = checked.pathExists();
|
||||
if (exists && mustBeDir) {
|
||||
exists = checked.lstat().type == InputAccessor::tDirectory;
|
||||
}
|
||||
auto st = checked.maybeLstat();
|
||||
auto exists = st && (!mustBeDir || st->type == SourceAccessor::tDirectory);
|
||||
v.mkBool(exists);
|
||||
} catch (SysError & e) {
|
||||
/* Don't give away info from errors while canonicalising
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue