mirror of
https://github.com/NixOS/nix.git
synced 2025-12-04 08:00:59 +01:00
Cleanup
This commit is contained in:
parent
7f576f5dfe
commit
c257c82447
3 changed files with 17 additions and 6 deletions
|
|
@ -54,18 +54,16 @@ struct MountedInputAccessor : InputAccessor
|
|||
std::pair<ref<InputAccessor>, CanonPath> resolve(CanonPath path)
|
||||
{
|
||||
// Find the nearest parent of `path` that is a mount point.
|
||||
std::vector<std::string> ss;
|
||||
std::vector<std::string> subpath;
|
||||
while (true) {
|
||||
auto i = mounts.find(path);
|
||||
if (i != mounts.end()) {
|
||||
auto subpath = CanonPath::root;
|
||||
for (auto j = ss.rbegin(); j != ss.rend(); ++j)
|
||||
subpath.push(*j);
|
||||
return {i->second, std::move(subpath)};
|
||||
std::reverse(subpath.begin(), subpath.end());
|
||||
return {i->second, CanonPath(subpath)};
|
||||
}
|
||||
|
||||
assert(!path.isRoot());
|
||||
ss.push_back(std::string(*path.baseName()));
|
||||
subpath.push_back(std::string(*path.baseName()));
|
||||
path.pop();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue