1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 01:11:15 +02:00

Factor out nix::maybeLstat

This function is nice for more than `PosixSourceAccessor`. We can make a
few things simpler with it.

Note that the error logic slightly changes in some of the call sites, in
that we also count `ENOTDIR` and not just `ENOENT` as not having the
file, but that should be fine.
This commit is contained in:
John Ericson 2024-03-29 15:21:10 -04:00
parent eeecbb9c36
commit 8be347afca
5 changed files with 36 additions and 37 deletions

View file

@ -84,6 +84,7 @@ bool isDirOrInDir(std::string_view path, std::string_view dir);
*/
struct stat stat(const Path & path);
struct stat lstat(const Path & path);
std::optional<struct stat> maybeLstat(const Path & path);
/**
* @return true iff the given path exists.