diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2024-03-30 11:23:29 -0400 |
---|---|---|
committer | K900 <me@0upti.me> | 2024-04-11 15:43:41 +0300 |
commit | aeee22e5a17404b10dd14b5289e302eaf546e1aa (patch) | |
tree | 3bed2463ffd9916104b95fcb58be5537d65f800c /src/libutil/util.hh | |
parent | 99845e0e01eaa2120b10c22591c43c4305f5ba51 (diff) |
Merge pull request #10362 from obsidiansystems/maybeLstat
Factor out `nix::maybeLstat`
(cherry-picked from commit 9b88e5284608116b7db0dbd3d5dd7a33b90d52d7)
Change-Id: Id890525e847c890fad6593c594772826ac4d1d50
Diffstat (limited to 'src/libutil/util.hh')
-rw-r--r-- | src/libutil/util.hh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 29a70447e..61df6c4f8 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -115,6 +115,12 @@ struct stat stat(const Path & path); struct stat lstat(const Path & path); /** + * `lstat` the given path if it exists. + * @return std::nullopt if the path doesn't exist, or an optional containing the result of `lstat` otherwise + */ +std::optional<struct stat> maybeLstat(const Path & path); + +/** * @return true iff the given path exists. */ bool pathExists(const Path & path); |