ADD: Load folder system icon under Linux when an absolute icon file name used (fixes #2061)

This commit is contained in:
Alexander Koblov 2025-02-08 14:41:23 +03:00
commit d3a2c1b0d4

View file

@ -513,6 +513,7 @@ var
AFile: TFile;
AIcon: TIcon;
iIndex : PtrInt;
FileExt: String;
GraphicClass: TGraphicClass;
bmStandartBitmap : Graphics.TBitMap = nil;
begin
@ -554,8 +555,9 @@ begin
else
{$ENDIF}
begin
FileExt := ExtractOnlyFileExt(sFileName);
// if file is graphic
GraphicClass:= GetGraphicClassForFileExtension(ExtractOnlyFileExt(sFileName));
GraphicClass:= GetGraphicClassForFileExtension(FileExt);
if (GraphicClass <> nil) and mbFileExists(sFileName) then
begin
if (GraphicClass = TIcon) then
@ -579,6 +581,11 @@ begin
end;
AIcon.Free;
end
else if (GraphicClass = TScalableVectorGraphics) then
begin
Stretch := False;
bmStandartBitmap := TScalableVectorGraphics.CreateBitmap(sFileName, iIconSize, iIconSize)
end
else begin
LoadBitmapFromFile(sFileName, bmStandartBitmap);
end;
@ -1037,7 +1044,7 @@ begin
if Length(AIconName) = 0 then
Result:= -1
else begin
Result:= CheckAddThemePixmap(AIconName);
Result:= CheckAddPixmap(AIconName);
end;
if (Result < 0) and (AIconName <> 'folder') then
begin