mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-27 00:06:16 +02:00
Enable the --store option to take relative paths
In nix commands which accept --store options, we can now specify a relative path, which will be canonicalized.
This commit is contained in:
parent
015e1c2131
commit
e197bc6229
1 changed files with 5 additions and 2 deletions
|
@ -864,7 +864,7 @@ StoreType getStoreType(const std::string & uri, const std::string & stateDir)
|
|||
{
|
||||
if (uri == "daemon") {
|
||||
return tDaemon;
|
||||
} else if (uri == "local" || hasPrefix(uri, "/")) {
|
||||
} else if (uri == "local" || hasPrefix(uri, "/") || hasPrefix(uri, "./")) {
|
||||
return tLocal;
|
||||
} else if (uri == "" || uri == "auto") {
|
||||
if (access(stateDir.c_str(), R_OK | W_OK) == 0)
|
||||
|
@ -888,8 +888,11 @@ static RegisterStoreImplementation regStore([](
|
|||
return std::shared_ptr<Store>(std::make_shared<UDSRemoteStore>(params));
|
||||
case tLocal: {
|
||||
Store::Params params2 = params;
|
||||
if (hasPrefix(uri, "/"))
|
||||
if (hasPrefix(uri, "/")) {
|
||||
params2["root"] = uri;
|
||||
} else if (hasPrefix(uri, "./")) {
|
||||
params2["root"] = absPath(uri);
|
||||
}
|
||||
return std::shared_ptr<Store>(std::make_shared<LocalStore>(params2));
|
||||
}
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue