Skip to content

Commit

Permalink
Fix tree structure for existing folders.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Apr 14, 2021
1 parent 529efd5 commit b70335d
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions Server/Pages/ScriptsPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit b70335d

Please sign in to comment.