mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 07:22:43 +01:00
SourceAccessor: Make lstat() virtual
With FilteringSourceAccessor, lstat() needs to throw a different exception if the path is inaccessible than if it doesn't exist.
This commit is contained in:
parent
46095284f1
commit
55c7ef9d40
5 changed files with 33 additions and 2 deletions
|
|
@ -121,7 +121,7 @@ struct SourceAccessor : std::enable_shared_from_this<SourceAccessor>
|
|||
std::string typeString();
|
||||
};
|
||||
|
||||
Stat lstat(const CanonPath & path);
|
||||
virtual Stat lstat(const CanonPath & path);
|
||||
|
||||
virtual std::optional<Stat> maybeLstat(const CanonPath & path) = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,12 @@ struct MountedSourceAccessorImpl : MountedSourceAccessor
|
|||
return accessor->readFile(subpath);
|
||||
}
|
||||
|
||||
Stat lstat(const CanonPath & path) override
|
||||
{
|
||||
auto [accessor, subpath] = resolve(path);
|
||||
return accessor->lstat(subpath);
|
||||
}
|
||||
|
||||
std::optional<Stat> maybeLstat(const CanonPath & path) override
|
||||
{
|
||||
auto [accessor, subpath] = resolve(path);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue