@@ -172,7 +172,6 @@ private unsafe bool UpdateRecentFilesInternal()
172172 {
173173 HRESULT hr = default ;
174174
175- // TODO: Use IShellUrl to perse all what FE can parse
176175 string szFolderShellPath = "Shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}" ;
177176 var shellItemIid = typeof ( IShellItem ) . GUID ;
178177 using ComPtr < IShellItem > pFolderShellItem = default ;
@@ -188,33 +187,30 @@ private unsafe bool UpdateRecentFilesInternal()
188187
189188 // Enumerate recent items and populate the list
190189 int index = 0 ;
191- var shellLinkIid = typeof ( IShellLinkW ) . GUID ;
192- var sfUIObjectBHID = PInvoke . BHID_SFUIObject ;
193190 using ComPtr < IShellItem > pShellItem = default ;
194191 while ( pEnumShellItems . Get ( ) ->Next ( 1 , pShellItem . GetAddressOf ( ) ) == HRESULT . S_OK )
195192 {
196193 // Get top 20 items
197194 if ( index is 20 )
198195 break ;
199196
200- // Get IShellLink
201- using ComPtr < IShellLinkW > pShellLink = default ;
202- pShellItem . Get ( ) ->BindToHandler ( null , & sfUIObjectBHID , & shellLinkIid , ( void * * ) pShellLink . GetAddressOf ( ) ) ;
203-
204197 // Get the target path
205198 pShellItem . Get ( ) ->GetDisplayName ( SIGDN . SIGDN_DESKTOPABSOLUTEEDITING , out var szTargetItemPath ) ;
206199 if ( szTargetItemPath . Value == null )
207200 pShellItem . Get ( ) ->GetDisplayName ( SIGDN . SIGDN_FILESYSPATH , out szTargetItemPath ) ;
208201 var targetPath = szTargetItemPath . ToString ( ) ;
202+ PInvoke . CoTaskMemFree ( ( void * ) szTargetItemPath . Value ) ;
209203
210204 // Get the display name
211- var szFileName = GetPropertyKey ( pShellItem . Get ( ) , "System.ItemNameDisplay" ) ;
212- var fileName = szFileName . ToString ( ) ;
213- // TODO: Try also SIGDN_NORMALDISPLAY first and then SIGDN_PARENTRELATIVEPARSING too
205+ var fileName = GetPropertyKey ( pShellItem . Get ( ) , "System.ItemNameDisplay" ) ;
206+ // TODO: Probably should try also SIGDN_NORMALDISPLAY and then SIGDN_PARENTRELATIVEPARSING too?
214207
215- // Strip the file extension except when the file name contains only extension (e.g. ".gitignore")
216- string strippedExtension = SystemIO . Path . GetFileNameWithoutExtension ( fileName ) ;
217- fileName = string . IsNullOrEmpty ( strippedExtension ) ? SystemIO . Path . GetFileName ( fileName ) : strippedExtension ;
208+ // Strip the file extension except when the file name only contains extension (e.g. ".gitignore")
209+ if ( ! FoldersSettingsService . ShowFileExtensions )
210+ {
211+ string strippedExtension = SystemIO . Path . GetFileNameWithoutExtension ( fileName ) ;
212+ fileName = string . IsNullOrEmpty ( strippedExtension ) ? SystemIO . Path . GetFileName ( fileName ) : strippedExtension ;
213+ }
218214
219215 recentItems . Add ( new ( )
220216 {
0 commit comments