aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-04-25 14:09:01 +0200
committerEelco Dolstra <edolstra@gmail.com>2017-04-25 14:09:01 +0200
commit0b6220fbd6869ec9f48094b85350ef2ea0429b14 (patch)
tree3b4de780cd5b30df4beb5944f12a2e86d2c9d8ad /src
parent7ee81f3887353cae2feecb98b482badf57a1fd5b (diff)
Interpret any installable containing a slash as a path
So "nix path-info ./result" now works.
Diffstat (limited to 'src')
-rw-r--r--src/nix/installables.cc18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/nix/installables.cc b/src/nix/installables.cc
index 3cf4a6f8d..45517443c 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)