mirror of
https://github.com/NixOS/nix.git
synced 2025-11-30 06:01:00 +01:00
Improve symlink handling
This commit is contained in:
parent
2a53574675
commit
df2aa29690
7 changed files with 51 additions and 22 deletions
|
|
@ -26,11 +26,6 @@ void CanonPath::pop()
|
|||
path.resize(std::max((size_t) 1, slash));
|
||||
}
|
||||
|
||||
CanonPath CanonPath::resolveSymlinks() const
|
||||
{
|
||||
return CanonPath(unchecked_t(), canonPath(abs(), true));
|
||||
}
|
||||
|
||||
bool CanonPath::isWithin(const CanonPath & parent) const
|
||||
{
|
||||
return !(
|
||||
|
|
|
|||
|
|
@ -91,8 +91,8 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
Iterator begin() { return Iterator(rel()); }
|
||||
Iterator end() { return Iterator(rel().substr(path.size() - 1)); }
|
||||
Iterator begin() const { return Iterator(rel()); }
|
||||
Iterator end() const { return Iterator(rel().substr(path.size() - 1)); }
|
||||
|
||||
std::optional<CanonPath> parent() const;
|
||||
|
||||
|
|
@ -136,8 +136,6 @@ public:
|
|||
return i == path.end() && j != x.path.end();
|
||||
}
|
||||
|
||||
CanonPath resolveSymlinks() const;
|
||||
|
||||
/* Return true if `this` is equal to `parent` or a child of
|
||||
`parent`. */
|
||||
bool isWithin(const CanonPath & parent) const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue