2023-10-18 18:34:58 +03:00
|
|
|
#include "memory-input-accessor.hh"
|
2023-11-03 01:39:09 +02:00
|
|
|
#include "memory-source-accessor.hh"
|
2023-10-18 18:34:58 +03:00
|
|
|
|
|
|
|
namespace nix {
|
|
|
|
|
2023-11-03 01:39:09 +02:00
|
|
|
struct MemoryInputAccessorImpl : MemoryInputAccessor, MemorySourceAccessor
|
2023-10-18 18:34:58 +03:00
|
|
|
{
|
|
|
|
SourcePath addFile(CanonPath path, std::string && contents) override
|
|
|
|
{
|
2023-11-03 01:39:09 +02:00
|
|
|
return {
|
|
|
|
ref(shared_from_this()),
|
|
|
|
MemorySourceAccessor::addFile(path, std::move(contents))
|
|
|
|
};
|
2023-10-18 18:34:58 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
ref<MemoryInputAccessor> makeMemoryInputAccessor()
|
|
|
|
{
|
|
|
|
return make_ref<MemoryInputAccessorImpl>();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|