mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
9e762454cf
Fixes #10039.
29 lines
663 B
C++
29 lines
663 B
C++
#include "memory-input-accessor.hh"
|
|
#include "memory-source-accessor.hh"
|
|
#include "source-path.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>();
|
|
}
|
|
|
|
ref<InputAccessor> makeEmptyInputAccessor()
|
|
{
|
|
static auto empty = makeMemoryInputAccessor().cast<InputAccessor>();
|
|
return empty;
|
|
}
|
|
|
|
}
|