From 6b9d9c50c79368a0e4c196ad14213fc3faf0e6b2 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Thu, 21 Jul 2022 02:17:11 -0500 Subject: [PATCH] [ox/fs] Add separate case for write in FileLocation model --- deps/ox/src/ox/fs/filesystem/filelocation.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deps/ox/src/ox/fs/filesystem/filelocation.hpp b/deps/ox/src/ox/fs/filesystem/filelocation.hpp index 878d5043..790db568 100644 --- a/deps/ox/src/ox/fs/filesystem/filelocation.hpp +++ b/deps/ox/src/ox/fs/filesystem/filelocation.hpp @@ -145,11 +145,15 @@ constexpr Error model(T *io, CommonPtrWith auto *fa) noexcept { int8_t type = 0; oxReturnError(io->field("type", &type)); oxReturnError(io->field("data", UnionView(&fa->m_data, 0))); - } else { + } else if constexpr(ox_strcmp(T::opType(), OpType::Read) == 0) { auto type = static_cast(fa->m_type); oxReturnError(io->field("type", &type)); fa->m_type = static_cast(type); oxReturnError(io->field("data", UnionView(&fa->m_data, static_cast(fa->m_type)))); + } else if constexpr(ox_strcmp(T::opType(), OpType::Write) == 0) { + auto type = static_cast(fa->m_type); + oxReturnError(io->field("type", &type)); + oxReturnError(io->field("data", UnionView(&fa->m_data, static_cast(fa->m_type)))); } return OxError(0); }