diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2020-07-21 15:55:27 +0000 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2020-07-21 15:55:27 +0000 |
commit | 02639716eae1af1c2cbbb1760a14d055f23d1ff5 (patch) | |
tree | 015aae9fb254df08457027638e0191f2c3cee420 /src/libstore | |
parent | 0aa79dcc6f4e67891cdd9500ae4ce85e4189a951 (diff) | |
parent | 6cce32c8e8b9559f197f6d3e8814796cfc490582 (diff) |
Merge branch 'allow-relative-paths-in-store-option' into remove-storetype-delegate-regStore
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/local-store.cc | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 9752f3c5f..88ed0dec3 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -1579,6 +1579,14 @@ 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) @@ -1586,9 +1594,7 @@ static RegisterStoreImplementation regStore([]( { Store::Params params2 = params; if (uri == "local") { - } else if (hasPrefix(uri, "/")) { - params2["root"] = uri; - } else if (hasPrefix(uri, "./")) { + } else if (isNonUriPath(uri)) { params2["root"] = absPath(uri); } else { return nullptr; |