aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/path.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/path.cc')
-rw-r--r--src/libstore/path.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstore/path.cc b/src/libstore/path.cc
index a33bec3ed..70b919adc 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(const Path & path) const
+{
+ return (bool) maybeParseStorePath(path);
+}
+
StorePathSet Store::parseStorePathSet(const PathSet & paths) const
{
StorePathSet res;