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

Commit 8f1763d

Browse files
Fix logic to display file icon when there is no icon for a file that has a meta
1 parent 9671f40 commit 8f1763d

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

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)