diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-03-04 13:58:42 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-03-04 13:58:42 +0100 |
commit | 73b6d87e17bbe3c8612af2b9f369d92d3726efbe (patch) | |
tree | 8b2b9e76744746122fcea962dd9d98075061d0b0 /src/libstore/path.cc | |
parent | f443d5ca19f07153af930686dd7aec44b88f16fd (diff) | |
parent | d37dc71e3cf077fa5d24a9bf8395deae21cc4410 (diff) |
Merge remote-tracking branch 'origin/master' into flakes
Diffstat (limited to 'src/libstore/path.cc')
-rw-r--r-- | src/libstore/path.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstore/path.cc b/src/libstore/path.cc index a33bec3ed..9a28aa96a 100644 --- a/src/libstore/path.cc +++ b/src/libstore/path.cc @@ -55,6 +55,20 @@ StorePath Store::parseStorePath(std::string_view path) const return StorePath::make(path, storeDir); } +std::optional<StorePath> Store::maybeParseStorePath(std::string_view path) const +{ + try { + return parseStorePath(path); + } catch (Error &) { + return {}; + } +} + +bool Store::isStorePath(std::string_view path) const +{ + return (bool) maybeParseStorePath(path); +} + StorePathSet Store::parseStorePathSet(const PathSet & paths) const { StorePathSet res; |