1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

Clean up resolveSearchPathElem

We should use `std::optional<std::string>` not `std::pair<bool,
std::string>` for an optional string.
This commit is contained in:
John Ericson 2023-06-23 12:31:09 -04:00
parent 8d871e1822
commit 87dcd09047
3 changed files with 37 additions and 30 deletions

View file

@ -571,22 +571,22 @@ EvalState::EvalState(
allowedPaths = PathSet();
for (auto & i : searchPath) {
auto r = resolveSearchPathElem(i);
if (!r.first) continue;
auto r = resolveSearchPathElem(i.path);
if (!r) continue;
auto path = r.second;
auto path = *std::move(r);
if (store->isInStore(r.second)) {
if (store->isInStore(path)) {
try {
StorePathSet closure;
store->computeFSClosure(store->toStorePath(r.second).first, closure);
store->computeFSClosure(store->toStorePath(path).first, closure);
for (auto & path : closure)
allowPath(path);
} catch (InvalidPath &) {
allowPath(r.second);
allowPath(path);
}
} else
allowPath(r.second);
allowPath(path);
}
}