File tree Expand file tree Collapse file tree
Plugins/Flow.Launcher.Plugin.Program/Programs Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
22using System . IO ;
3+ using System . Runtime . InteropServices ;
34using Windows . Win32 ;
45using Windows . Win32 . Foundation ;
56
@@ -25,12 +26,22 @@ public static unsafe string GetLocalizedName(string path)
2526 return string . Empty ;
2627 }
2728
28- PWSTR displayName ;
29- shellItem . GetDisplayName ( Windows . Win32 . UI . Shell . SIGDN . SIGDN_NORMALDISPLAY , & displayName ) ;
30- string filename = displayName . ToString ( ) ;
31- PInvoke . CoTaskMemFree ( displayName ) ;
32-
33- return filename ;
29+ try
30+ {
31+ PWSTR displayName ;
32+ shellItem . GetDisplayName ( Windows . Win32 . UI . Shell . SIGDN . SIGDN_NORMALDISPLAY , & displayName ) ;
33+ string filename = displayName . ToString ( ) ;
34+ PInvoke . CoTaskMemFree ( displayName ) ;
35+ return filename ;
36+ }
37+ catch
38+ {
39+ return string . Empty ;
40+ }
41+ finally
42+ {
43+ Marshal . ReleaseComObject ( shellItem ) ;
44+ }
3445 }
3546
3647 /// <summary>
You can’t perform that action at this time.
0 commit comments