Fix tree structure for existing folders.

This commit is contained in:
Jared 2021-04-14 07:26:07 -07:00 committed by Jared Goodwin
parent 0191e02a59
commit cba80d09ce

View File

@ -100,23 +100,20 @@
{
var existingParent = root.Find(x => x.Name == paths[i]);
var newItem = new ScriptTreeNode()
if (existingParent is null)
{
Name = paths[i]
};
if (existingParent is not null)
{
newItem.ItemType = TreeItemType.Item;
existingParent.ChildItems.Add(newItem);
var newItem = new ScriptTreeNode()
{
Name = paths[i],
ItemType = TreeItemType.Folder
};
root.Add(newItem);
root = newItem.ChildItems;
}
else
{
newItem.ItemType = TreeItemType.Folder;
root.Add(newItem);
root = existingParent.ChildItems;
}
root = newItem.ChildItems;
}
}