Skip to content

Commit bb07092

Browse files
authored
fix: 修复AutoPathing下的非顶层文件夹不显示图标的问题 (#1665)
1 parent 0c02808 commit bb07092

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

BetterGenshinImpact/ViewModel/Pages/MapPathingViewModel.cs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,28 @@ private void InitScriptListViewData()
5757
// 循环写入 root.Children
5858
foreach (var item in root.Children)
5959
{
60-
// 补充图标
61-
if (!string.IsNullOrEmpty(item.FilePath) && File.Exists(Path.Combine(item.FilePath, "icon.ico")))
62-
{
63-
item.IconFilePath = Path.Combine(item.FilePath, "icon.ico");
64-
}
65-
else
66-
{
67-
item.IconFilePath = item.FilePath;
68-
}
69-
60+
SetIconForNodeAndChildren(item);
7061
TreeList.Add(item);
7162
}
7263
}
7364

65+
private void SetIconForNodeAndChildren(FileTreeNode<PathingTask> node)
66+
{
67+
if (!string.IsNullOrEmpty(node.FilePath) && File.Exists(Path.Combine(node.FilePath, "icon.ico")))
68+
{
69+
node.IconFilePath = Path.Combine(node.FilePath, "icon.ico");
70+
}
71+
else
72+
{
73+
node.IconFilePath = node.FilePath;
74+
}
75+
76+
foreach (var child in node.Children)
77+
{
78+
SetIconForNodeAndChildren(child);
79+
}
80+
}
81+
7482
public override void OnNavigatedTo()
7583
{
7684
InitScriptListViewData();

0 commit comments

Comments
 (0)