UPD: split image cache for Ext and Fullpath as NameSpace on macOS

This commit is contained in:
rich2014 2026-01-26 18:51:47 +08:00
commit 37e7749fe8
4 changed files with 11 additions and 8 deletions

View file

@ -97,7 +97,7 @@ begin
{$IFDEF DARWIN}
if path = PathDelim then
Result:= darwinImageCacheManager.copyIconForFileExt( FCurrentAddress, iconSize );
Result:= darwinImageCacheForExt.copyIconForFileExt( FCurrentAddress, iconSize );
{$ENDIF}
end;

View file

@ -10,7 +10,7 @@ uses
uiCloudDrive, uSearchResultFileSource, uFileSystemFileSource, uFileSource,
uFile, uDisplayFile, uFileProperty,
uFileView, uFileViewNotebook,
uDarwinFinderModel, uDarwinFinder, uDarwinImage, uDarwinFile, uDarwinUtil,
uDarwinFinderModel, uDarwinFinder, uDarwinImage, uDarwinFile,
ulng, uGlobs,
MacOSAll, CocoaAll;
@ -152,7 +152,7 @@ function TSmartFolderSearchResultFileSource.GetCustomIcon(
const path: String;
const iconSize: Integer ): TBitmap;
begin
Result:= darwinImageCacheManager.copyIconForFileExt( 'savedSearch', iconSize );
Result:= darwinImageCacheForExt.copyIconForFileExt( 'savedSearch', iconSize );
end;
{ TDarwinSearchResultHandler }

View file

@ -64,7 +64,8 @@ type
end;
var
darwinImageCacheManager: TDarwinImageCacheManager;
darwinImageCacheForPath: TDarwinImageCacheManager;
darwinImageCacheForExt: TDarwinImageCacheManager;
implementation
@ -290,10 +291,12 @@ begin
end;
initialization
darwinImageCacheManager:= TDarwinImageCacheManager.Create;
darwinImageCacheForPath:= TDarwinImageCacheManager.Create;
darwinImageCacheForExt:= TDarwinImageCacheManager.Create;
finalization
FreeAndNil( darwinImageCacheManager );
FreeAndNil( darwinImageCacheForPath );
FreeAndNil( darwinImageCacheForExt );
end.

View file

@ -719,12 +719,12 @@ begin
Result:= nil;
if path = GetRootDir(path) then begin
TiCloudDriveFileSource.GetMainIcon( iconPath );
Result:= darwinImageCacheManager.copyImageForFileContent( iconPath, iconSize );
Result:= darwinImageCacheForPath.copyImageForFileContent( iconPath, iconSize );
end else begin
realPath:= self.GetRealPath( path );
image:= getAppIconByPath( realPath );
if image <> nil then
Result:= darwinImageCacheManager.copyImageForNSImage( realPath, image );
Result:= darwinImageCacheForPath.copyImageForNSImage( realPath, image );
end;
end;