From 7b6b53b7d304014503332957729c49cbb60f7f59 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Thu, 20 Jun 2019 22:55:26 -0500 Subject: [PATCH] [ox/fs] Remove unused parents parameter from Director::write --- deps/ox/src/ox/fs/filesystem/directory.hpp | 23 ++++++++-------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/deps/ox/src/ox/fs/filesystem/directory.hpp b/deps/ox/src/ox/fs/filesystem/directory.hpp index 8d9c93d9..b6c8a8f5 100644 --- a/deps/ox/src/ox/fs/filesystem/directory.hpp +++ b/deps/ox/src/ox/fs/filesystem/directory.hpp @@ -108,7 +108,7 @@ class Directory { /** * @param parents indicates the operation should create non-existent directories in the path, like mkdir -p */ - Error write(PathIterator it, InodeId_t inode, bool parents = false, FileName *nameBuff = nullptr) noexcept; + Error write(PathIterator it, InodeId_t inode, FileName *nameBuff = nullptr) noexcept; Error remove(PathIterator it, FileName *nameBuff = nullptr) noexcept; @@ -172,7 +172,7 @@ Error Directory::mkdir(PathIterator path, bool parents, Fi Directory child(m_fs, childInode); oxReturnError(child.init()); - auto err = write(name->c_str(), childInode, false); + auto err = write(name->c_str(), childInode); if (err) { oxLogError(err); // could not index the directory, delete it @@ -190,7 +190,7 @@ Error Directory::mkdir(PathIterator path, bool parents, Fi } template -Error Directory::write(PathIterator path, InodeId_t inode, bool parents, FileName *nameBuff) noexcept { +Error Directory::write(PathIterator path, InodeId_t inode, FileName *nameBuff) noexcept { InodeId_t nextChild = 0; // reuse nameBuff if it has already been allocated, as it is a rather large variable @@ -208,22 +208,15 @@ Error Directory::write(PathIterator path, InodeId_t inode, nextChild = findEntry(*name); oxTrace("ox::fs::Directory::write") << name->c_str() << ": " << nextChild; - if (!nextChild) { - if (parents) { - oxReturnError(Directory(m_fs, nextChild).init()); - nextChild = findEntry(*name); - } else { - oxTrace("ox::fs::Directory::write") << name->c_str() - << "not found and not allowed to create it."; - return OxError(1); - } - } - if (nextChild) { // reuse name because it is a rather large variable and will not be used again // be attentive that this remains true name = nullptr; - return Directory(m_fs, nextChild).write(path + 1, inode, parents, nameBuff); + return Directory(m_fs, nextChild).write(path + 1, inode, nameBuff); + } else { + oxTrace("ox::fs::Directory::write") << name->c_str() + << "not found and not allowed to create it."; + return OxError(1); } } else { // insert the new entry on this directory