mirror of
https://github.com/NixOS/nix
synced 2025-06-27 00:11:17 +02:00
SourceAccessor: Change the main interface from lstat() to maybeLstat()
This commit is contained in:
parent
8ffd1695ce
commit
cdb27c1519
9 changed files with 22 additions and 20 deletions
|
@ -42,12 +42,12 @@ Hash SourceAccessor::hashPath(
|
|||
return sink.finish().first;
|
||||
}
|
||||
|
||||
std::optional<SourceAccessor::Stat> SourceAccessor::maybeLstat(const CanonPath & path)
|
||||
SourceAccessor::Stat SourceAccessor::lstat(const CanonPath & path)
|
||||
{
|
||||
// FIXME: merge these into one operation.
|
||||
if (!pathExists(path))
|
||||
return {};
|
||||
return lstat(path);
|
||||
if (auto st = maybeLstat(path))
|
||||
return *st;
|
||||
else
|
||||
throw Error("path '%s' does not exist", showPath(path));
|
||||
}
|
||||
|
||||
std::string SourceAccessor::showPath(const CanonPath & path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue