mirror of
https://github.com/NixOS/nix
synced 2025-07-06 09:11:47 +02:00
Merge InputAccessor into SourceAccessor
After the removal of the InputAccessor::fetchToStore() method, the only remaining functionality in InputAccessor was `fingerprint` and `getLastModified()`, and there is no reason to keep those in a separate class.
This commit is contained in:
parent
00ca2b05b8
commit
ba5929c7be
35 changed files with 130 additions and 188 deletions
|
@ -108,7 +108,7 @@ std::string MemorySourceAccessor::readLink(const CanonPath & path)
|
|||
throw Error("file '%s' is not a symbolic link", path);
|
||||
}
|
||||
|
||||
CanonPath MemorySourceAccessor::addFile(CanonPath path, std::string && contents)
|
||||
SourcePath MemorySourceAccessor::addFile(CanonPath path, std::string && contents)
|
||||
{
|
||||
auto * f = open(path, File { File::Regular {} });
|
||||
if (!f)
|
||||
|
@ -118,7 +118,7 @@ CanonPath MemorySourceAccessor::addFile(CanonPath path, std::string && contents)
|
|||
else
|
||||
throw Error("file '%s' is not a regular file", path);
|
||||
|
||||
return path;
|
||||
return SourcePath{ref(shared_from_this()), path};
|
||||
}
|
||||
|
||||
|
||||
|
@ -184,4 +184,10 @@ void MemorySink::createSymlink(const Path & path, const std::string & target)
|
|||
throw Error("file '%s' is not a symbolic link", path);
|
||||
}
|
||||
|
||||
ref<SourceAccessor> makeEmptySourceAccessor()
|
||||
{
|
||||
static auto empty = make_ref<MemorySourceAccessor>().cast<SourceAccessor>();
|
||||
return empty;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue