From f10373864da6e0c6c0b87b2f80209e4fe39960f8 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 28 Jan 2022 19:44:20 -0600 Subject: [PATCH] [ox/fs] Fix duplication of dir entries on update of file --- deps/ox/src/ox/fs/filesystem/directory.hpp | 1 - deps/ox/src/ox/fs/filesystem/filesystem.hpp | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/deps/ox/src/ox/fs/filesystem/directory.hpp b/deps/ox/src/ox/fs/filesystem/directory.hpp index b60e812f..427e0f11 100644 --- a/deps/ox/src/ox/fs/filesystem/directory.hpp +++ b/deps/ox/src/ox/fs/filesystem/directory.hpp @@ -240,7 +240,6 @@ Error Directory::write(PathIterator path, InodeId_t inode, return OxError(1, "Could not allocate memory for copy of Directory"); } - // TODO: look for old version of this entry and delete it oxReturnError(cpy->setSize(newSize)); auto val = cpy->malloc(entryDataSize).value; if (!val.valid()) { diff --git a/deps/ox/src/ox/fs/filesystem/filesystem.hpp b/deps/ox/src/ox/fs/filesystem/filesystem.hpp index cddc7ba8..8af58dc1 100644 --- a/deps/ox/src/ox/fs/filesystem/filesystem.hpp +++ b/deps/ox/src/ox/fs/filesystem/filesystem.hpp @@ -333,9 +333,9 @@ Error FileSystemTemplate::write(const char *path, const vo if (err) { oxRequire(generatedId, m_fs.generateInodeId()); inode = generatedId; + oxRequireM(rootDir, this->rootDir()); + oxReturnError(rootDir.write(path, inode)); } - oxRequireM(rootDir, this->rootDir()); - oxReturnError(rootDir.write(path, inode)); oxReturnError(write(inode, buffer, size, fileType)); return OxError(0); }