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-07-09 23:13:30 -04:00
parent 8d871e1822
commit 87dcd09047
3 changed files with 37 additions and 30 deletions
+7 -7
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);
}
}