[ox/fs] Fix mkdir -p
This commit is contained in:
parent
eed1a1a94e
commit
8e82ba2f2e
26
deps/ox/src/ox/fs/filesystem/directory.hpp
vendored
26
deps/ox/src/ox/fs/filesystem/directory.hpp
vendored
@ -200,16 +200,23 @@ Error Directory<FileStore, InodeId_t>::write(PathIterator path, InodeId_t inode,
|
|||||||
auto name = nameBuff;
|
auto name = nameBuff;
|
||||||
|
|
||||||
if ((path + 1).hasNext()) {
|
if ((path + 1).hasNext()) {
|
||||||
oxTrace("ox::fs::Directory::write") << "Attempting to write to next sub-Directory";
|
|
||||||
|
|
||||||
oxReturnError(path.get(name));
|
oxReturnError(path.get(name));
|
||||||
nextChild = findEntry(*name);
|
|
||||||
|
|
||||||
if (!nextChild && parents) {
|
oxTrace("ox::fs::Directory::write") << "Attempting to write to next sub-Directory: "
|
||||||
oxReturnError(Directory(m_fs, nextChild).init());
|
<< name->c_str() << " of " << path.fullPath();
|
||||||
nextChild = findEntry(*name);
|
|
||||||
} else {
|
nextChild = findEntry(*name);
|
||||||
return OxError(1);
|
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) {
|
if (nextChild) {
|
||||||
@ -323,13 +330,14 @@ ValErr<typename FileStore::InodeId_t> Directory<FileStore, InodeId_t>::findEntry
|
|||||||
if (data.valid()) {
|
if (data.valid()) {
|
||||||
oxTrace("ox::fs::Directory::findEntry").del("") << "Comparing \"" << name.c_str() << "\" to \"" << data->name << "\"";
|
oxTrace("ox::fs::Directory::findEntry").del("") << "Comparing \"" << name.c_str() << "\" to \"" << data->name << "\"";
|
||||||
if (ox_strncmp(data->name, name.c_str(), name.len()) == 0) {
|
if (ox_strncmp(data->name, name.c_str(), name.len()) == 0) {
|
||||||
|
oxTrace("ox::fs::Directory::findEntry").del("") << "\"" << name.c_str() << "\" match found.";
|
||||||
return static_cast<InodeId_t>(data->inode);
|
return static_cast<InodeId_t>(data->inode);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
oxTrace("ox::fs::Directory::findEntry") << "INVALID DIRECTORY ENTRY";
|
oxTrace("ox::fs::Directory::findEntry") << "INVALID DIRECTORY ENTRY";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
oxTrace("ox::fs::Directory::findEntry::fail");
|
oxTrace("ox::fs::Directory::findEntry::fail") << "Entry not present";
|
||||||
return {0, OxError(1)};
|
return {0, OxError(1)};
|
||||||
} else {
|
} else {
|
||||||
oxTrace("ox::fs::Directory::findEntry::fail") << "Could not findEntry directory buffer";
|
oxTrace("ox::fs::Directory::findEntry::fail") << "Could not findEntry directory buffer";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user