Skip to content

Commit b24b4c7

Browse files
committed
优化 GetFilteredIcoPath 方法实现
1 parent 01d30dd commit b24b4c7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Mikoto/Helpers/Graphics/ImageHelper.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ public static Image GetGameIcon(string path)
5757

5858
private static string[] GetFilteredIcoPath(string path)
5959
{
60-
try
60+
var dir = Path.GetDirectoryName(path);
61+
if (Directory.Exists(dir))
6162
{
62-
return Directory.GetFiles(Path.GetDirectoryName(path)!, "*.ico").Where(p => !p.Contains("uninst")).ToArray();
63-
63+
return Directory.GetFiles(dir, "*.ico").Where(p => !p.Contains("uninst")).ToArray();
6464
}
65-
catch (DirectoryNotFoundException)
65+
else
6666
{
67-
return Array.Empty<string>();
67+
return [];
6868
}
6969
}
7070

0 commit comments

Comments
 (0)