22// Licensed under the MIT License. See the LICENSE.
33
44using Microsoft . UI . Xaml . Media . Imaging ;
5- using Windows . Storage ;
6- using Windows . Storage . FileProperties ;
75
86namespace Files . App . Utils . RecentItem
97{
@@ -40,11 +38,11 @@ public RecentItem(string linkPath) : base()
4038 /// <summary>
4139 /// Create a RecentItem from a ShellLinkItem (usually from shortcuts in `Windows\Recent`)
4240 /// </summary>
43- public RecentItem ( ShellLinkItem linkItem ) : base ( )
41+ public RecentItem ( ShellLinkItem linkItem , bool showFileExtension ) : base ( )
4442 {
4543 LinkPath = linkItem . FilePath ;
4644 RecentPath = linkItem . TargetPath ;
47- Name = NameOrPathWithoutExtension ( linkItem . FileName ) ;
45+ Name = showFileExtension ? linkItem . FileName : NameOrPathWithoutExtension ( linkItem . FileName ) ;
4846 LastModified = linkItem . ModifiedDate ;
4947 PIDL = linkItem . PIDL ;
5048 }
@@ -53,11 +51,11 @@ public RecentItem(ShellLinkItem linkItem) : base()
5351 /// Create a RecentItem from a ShellFileItem (usually from enumerating Quick Access directly).
5452 /// </summary>
5553 /// <param name="fileItem">The shell file item</param>
56- public RecentItem ( ShellFileItem fileItem ) : base ( )
54+ public RecentItem ( ShellFileItem fileItem , bool showFileExtension ) : base ( )
5755 {
5856 LinkPath = ShellStorageFolder . IsShellPath ( fileItem . FilePath ) ? fileItem . RecyclePath : fileItem . FilePath ; // use true path on disk for shell items
5957 RecentPath = LinkPath ; // intentionally the same
60- Name = NameOrPathWithoutExtension ( fileItem . FileName ) ;
58+ Name = showFileExtension ? fileItem . FileName : NameOrPathWithoutExtension ( fileItem . FileName ) ;
6159 LastModified = fileItem . ModifiedDate ;
6260 PIDL = fileItem . PIDL ;
6361 }
0 commit comments