mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2025-02-08 03:07:17 +02:00
![John Ericson](/assets/img/avatar_default.png)
The new `MemorySourceAccessor` rather than being a slightly lossy flat map is a complete in-memory model of file system objects. Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
22 lines
497 B
C++
22 lines
497 B
C++
#include "memory-input-accessor.hh"
|
|
#include "memory-source-accessor.hh"
|
|
|
|
namespace nix {
|
|
|
|
struct MemoryInputAccessorImpl : MemoryInputAccessor, MemorySourceAccessor
|
|
{
|
|
SourcePath addFile(CanonPath path, std::string && contents) override
|
|
{
|
|
return {
|
|
ref(shared_from_this()),
|
|
MemorySourceAccessor::addFile(path, std::move(contents))
|
|
};
|
|
}
|
|
};
|
|
|
|
ref<MemoryInputAccessor> makeMemoryInputAccessor()
|
|
{
|
|
return make_ref<MemoryInputAccessorImpl>();
|
|
}
|
|
|
|
}
|