diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-04-25T12·09+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-04-25T12·09+0200 |
commit | 0b6220fbd6869ec9f48094b85350ef2ea0429b14 (patch) | |
tree | 3b4de780cd5b30df4beb5944f12a2e86d2c9d8ad /src/nix/installables.cc | |
parent | 7ee81f3887353cae2feecb98b482badf57a1fd5b (diff) |
Interpret any installable containing a slash as a path
So "nix path-info ./result" now works.
Diffstat (limited to 'src/nix/installables.cc')
-rw-r--r-- | src/nix/installables.cc | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/nix/installables.cc b/src/nix/installables.cc index 3cf4a6f8d32b..45517443ca32 100644 --- a/src/nix/installables.cc +++ b/src/nix/installables.cc @@ -183,20 +183,16 @@ std::vector<std::shared_ptr<Installable>> InstallablesCommand::parseInstallables for (auto & installable : installables) { - if (std::string(installable, 0, 1) == "/") { + if (installable.find("/") != std::string::npos) { - if (store->isStorePath(installable)) { - if (isDerivation(installable)) - result.push_back(std::make_shared<InstallableStoreDrv>(installable)); - else - result.push_back(std::make_shared<InstallableStorePath>(installable)); - } + auto path = store->toStorePath(store->followLinksToStore(installable)); - else { - result.push_back(std::make_shared<InstallableStorePath>( - store->toStorePath(store->followLinksToStore(installable)))); + if (store->isStorePath(path)) { + if (isDerivation(path)) + result.push_back(std::make_shared<InstallableStoreDrv>(path)); + else + result.push_back(std::make_shared<InstallableStorePath>(path)); } - } else if (installable.compare(0, 1, "(") == 0) |