diff options
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; |