[PT Run] Do not get target file icon for .lnk files (#30228)

This commit is contained in:
Stefan Markovic
2023-12-06 23:35:42 +01:00
committed by GitHub
parent f00f2975fe
commit e10733efe0

View File

@@ -83,17 +83,10 @@ namespace Wox.Infrastructure.Image
public static BitmapSource GetThumbnail(string fileName, int width, int height, ThumbnailOptions options)
{
IntPtr hBitmap = IntPtr.Zero;
string targetLinkedFilePath = string.Empty;
if (Path.GetExtension(fileName).Equals(".lnk", StringComparison.OrdinalIgnoreCase))
{
// If the file has a '.lnk' extension, it is a shortcut file. Use the shellLinkHelper to retrieve the actual target file path from the shortcut.
IShellLinkHelper shellLinkHelper = new ShellLinkHelper();
targetLinkedFilePath = shellLinkHelper.RetrieveTargetPath(fileName);
}
if (!string.IsNullOrEmpty(targetLinkedFilePath))
{
hBitmap = ExtractIconToHBitmap(targetLinkedFilePath);
hBitmap = ExtractIconToHBitmap(fileName);
}
else
{