From 682ca665c9f11741f07f56579e09c41aa0e94d43 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sat, 10 Oct 2026 16:32:15 +0300 Subject: [PATCH] make memory device create file on flush --- src/io/devices/MemoryDevice.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/io/devices/MemoryDevice.cpp b/src/io/devices/MemoryDevice.cpp index f9f4760ee..ae08b0da3 100644 --- a/src/io/devices/MemoryDevice.cpp +++ b/src/io/devices/MemoryDevice.cpp @@ -14,8 +14,13 @@ std::filesystem::path io::MemoryDevice::resolve(std::string_view path) { std::unique_ptr io::MemoryDevice::write(std::string_view path) { std::string filePath = std::string(path); + + auto memoryStream = std::make_unique(); + memoryStream->set_sync_callback([this, filePath](std::string_view data) { + createFile(std::move(filePath), util::Buffer(data.data(), data.size())); + }); return std::make_unique( - std::make_unique(), + std::move(memoryStream), [this, filePath](auto ostream) { auto& memoryStream = dynamic_cast(*ostream); createFile(std::move(filePath), memoryStream.release());