Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 6c0791f

Browse files
authored
Merge pull request #202 from github-for-unity/fixes/deleted-files-and-folders
Fix to correct icon of deleted files
2 parents 968c158 + 6239ad4 commit 6c0791f

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/GitHub.Api/UI/TreeBuilder.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@ internal static FileTreeNode BuildTreeRoot(IList<GitStatusEntry> newEntries, Lis
119119
}
120120
}
121121

122-
// TODO: Filter .meta files - consider adding them as children of the asset or folder they're supporting
123122
// TODO: In stead of completely rebuilding the tree structure, figure out a way to migrate open/closed states from the old tree to the new
124123
// Build tree structure
125124

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/ChangesetTreeView.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ private void TreeNode(FileTreeNode node)
118118
var target = node.Target;
119119
var isFolder = node.Children.Any();
120120

121+
var isFolderForMeta = false;
122+
if (node.Children.Count() == 1)
123+
{
124+
isFolderForMeta = node.Children.First().Label.Substring(node.Label.Length).Equals(".meta");
125+
}
126+
121127
GUILayout.BeginHorizontal();
122128
{
123129
if (!Readonly)
@@ -186,7 +192,19 @@ private void TreeNode(FileTreeNode node)
186192

187193
if (Event.current.type == EventType.Repaint)
188194
{
189-
var icon = (Texture) node.Icon ?? (isFolder ? Styles.FolderIcon : Styles.DefaultAssetIcon);
195+
var icon = (Texture) node.Icon;
196+
if (icon == null)
197+
{
198+
if (isFolderForMeta || !isFolder)
199+
{
200+
icon = Styles.DefaultAssetIcon;
201+
}
202+
else
203+
{
204+
icon = Styles.FolderIcon;
205+
}
206+
}
207+
190208
if (icon != null)
191209
{
192210
GUI.DrawTexture(iconRect,

0 commit comments

Comments
 (0)