Refactor node creation logic

This commit is contained in:
EnderIce2 2024-03-11 23:35:01 +02:00
parent 0d2036139c
commit 42225a5cd9
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD

View File

@ -140,10 +140,9 @@ namespace vfs
this->Parent->Children.push_back(this); this->Parent->Children.push_back(this);
}; };
if (Parent) if (NoParent)
CreateWithParent(Name, Parent);
else if (NoParent)
{ {
Parent = nullptr;
const char *Path = Name; const char *Path = Name;
Node *RootNode = fs->FileSystemRoot->Children[0]; Node *RootNode = fs->FileSystemRoot->Children[0];
@ -211,6 +210,8 @@ namespace vfs
delete[] SegmentName; delete[] SegmentName;
} while (cwk_path_get_next_segment(&segment)); } while (cwk_path_get_next_segment(&segment));
} }
else if (Parent)
CreateWithParent(Name, Parent);
else else
{ {
this->Name = new char[strlen(Name) + 1]; this->Name = new char[strlen(Name) + 1];