Interpret any installable containing a slash as a path

So "nix path-info ./result" now works.
This commit is contained in:
Eelco Dolstra 2017-04-25 14:09:01 +02:00
parent 7ee81f3887
commit 0b6220fbd6
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -183,20 +183,16 @@ std::vector<std::shared_ptr<Installable>> InstallablesCommand::parseInstallables
for (auto & installable : installables) { for (auto & installable : installables) {
if (std::string(installable, 0, 1) == "/") { if (installable.find("/") != std::string::npos) {
if (store->isStorePath(installable)) { auto path = store->toStorePath(store->followLinksToStore(installable));
if (isDerivation(installable))
result.push_back(std::make_shared<InstallableStoreDrv>(installable)); if (store->isStorePath(path)) {
if (isDerivation(path))
result.push_back(std::make_shared<InstallableStoreDrv>(path));
else else
result.push_back(std::make_shared<InstallableStorePath>(installable)); result.push_back(std::make_shared<InstallableStorePath>(path));
} }
else {
result.push_back(std::make_shared<InstallableStorePath>(
store->toStorePath(store->followLinksToStore(installable))));
}
} }
else if (installable.compare(0, 1, "(") == 0) else if (installable.compare(0, 1, "(") == 0)