Skip to content

Commit 2109996

Browse files
avoid async call if not needed
1 parent 48a5153 commit 2109996

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Files.App/Helpers/Win32/Win32Helper.Storage.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ public static partial class Win32Helper
2929
public static async Task<string?> GetFileAssociationAsync(string filename, bool checkDesktopFirst = false)
3030
{
3131
if (checkDesktopFirst)
32-
return GetDesktopFileAssociation(filename) ?? (await GetUwpFileAssociations(filename)).FirstOrDefault();
32+
{
33+
var desktopAssociation = GetDesktopFileAssociation(filename);
34+
if (desktopAssociation is not null)
35+
return desktopAssociation;
36+
37+
return (await GetUwpFileAssociations(filename)).FirstOrDefault();
38+
}
3339

3440
return (await GetUwpFileAssociations(filename)).FirstOrDefault() ?? GetDesktopFileAssociation(filename);
3541
}

0 commit comments

Comments
 (0)