diff options
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r-- | src/libstore/local-store.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index a79b2da44..84f8d7752 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -1533,5 +1533,27 @@ void LocalStore::createUser(const std::string & userName, uid_t userId) } } +static bool isNonUriPath(const std::string & spec) { + return + // is not a URL + spec.find("://") == std::string::npos + // Has at least one path separator, and so isn't a single word that + // might be special like "auto" + && spec.find("/") != std::string::npos; +} + +static RegisterStoreImplementation regStore([]( + const std::string & uri, const Store::Params & params) + -> std::shared_ptr<Store> +{ + Store::Params params2 = params; + if (uri == "local") { + } else if (isNonUriPath(uri)) { + params2["root"] = absPath(uri); + } else { + return nullptr; + } + return std::shared_ptr<Store>(std::make_shared<LocalStore>(params2)); +}); } |