@@ -41,9 +41,13 @@ public class Main : ISettingProvider, IAsyncPlugin, IPluginI18n, IContextMenu, I
4141 "uninst000.exe" ,
4242 "uninstall.exe"
4343 } ;
44- // For cases when the uninstaller is named like "Uninstall Program Name.exe"
45- private const string CommonUninstallerPrefix = "uninstall" ;
46- private const string CommonUninstallerSuffix = ".exe" ;
44+ private static readonly string [ ] commonUninstallerPrefixs =
45+ {
46+ "uninstall" ,
47+ "卸载"
48+ } ;
49+ private const string ExeUninstallerSuffix = ".exe" ;
50+ private const string InkUninstallerSuffix = ".lnk" ;
4751
4852 static Main ( )
4953 {
@@ -96,10 +100,33 @@ private bool HideUninstallersFilter(IProgram program)
96100 {
97101 if ( ! _settings . HideUninstallers ) return true ;
98102 if ( program is not Win32 win32 ) return true ;
103+
104+ // First check the executable path
99105 var fileName = Path . GetFileName ( win32 . ExecutablePath ) ;
100- return ! commonUninstallerNames . Contains ( fileName , StringComparer . OrdinalIgnoreCase ) &&
101- ! ( fileName . StartsWith ( CommonUninstallerPrefix , StringComparison . OrdinalIgnoreCase ) &&
102- fileName . EndsWith ( CommonUninstallerSuffix , StringComparison . OrdinalIgnoreCase ) ) ;
106+ // For cases when the uninstaller is named like "uninst.exe"
107+ if ( commonUninstallerNames . Contains ( fileName , StringComparer . OrdinalIgnoreCase ) ) return false ;
108+ // For cases when the uninstaller is named like "Uninstall Program Name.exe"
109+ foreach ( var prefix in commonUninstallerPrefixs )
110+ {
111+ if ( fileName . StartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) &&
112+ fileName . EndsWith ( ExeUninstallerSuffix , StringComparison . OrdinalIgnoreCase ) )
113+ return false ;
114+ }
115+
116+ // Second check the ink path
117+ if ( ! string . IsNullOrEmpty ( win32 . LnkResolvedPath ) )
118+ {
119+ var inkFileName = Path . GetFileName ( win32 . FullPath ) ;
120+ // For cases when the uninstaller is named like "Uninstall Program Name.ink"
121+ foreach ( var prefix in commonUninstallerPrefixs )
122+ {
123+ if ( inkFileName . StartsWith ( prefix , StringComparison . OrdinalIgnoreCase ) &&
124+ inkFileName . EndsWith ( InkUninstallerSuffix , StringComparison . OrdinalIgnoreCase ) )
125+ return false ;
126+ }
127+ }
128+
129+ return true ;
103130 }
104131
105132 public async Task InitAsync ( PluginInitContext context )
0 commit comments