Browse Source

ADD: show Icon for Executable file without ext on macOS

rich2014 2 tháng trước cách đây
mục cha
commit
a601c76280
1 tập tin đã thay đổi với 17 bổ sung7 xóa
  1. 17 7
      src/platform/upixmapmanager.pas

+ 17 - 7
src/platform/upixmapmanager.pas

@@ -246,6 +246,7 @@ type
   {$ENDIF}
   {$ENDIF}
   {$IF DEFINED(DARWIN)}
   {$IF DEFINED(DARWIN)}
     function GetSystemFolderIcon: PtrInt;
     function GetSystemFolderIcon: PtrInt;
+    function GetSystemExecutableIcon: PtrInt;
     function GetMimeIcon(AFileExt: String; AIconSize: Integer): PtrInt;
     function GetMimeIcon(AFileExt: String; AIconSize: Integer): PtrInt;
     function LoadImageFileBitmap( const filename:String; const size:Integer ): TBitmap;
     function LoadImageFileBitmap( const filename:String; const size:Integer ): TBitmap;
   {$ENDIF}
   {$ENDIF}
@@ -1432,6 +1433,11 @@ begin
   Result:= GetMimeIcon(FileType, gIconsSize);
   Result:= GetMimeIcon(FileType, gIconsSize);
 end;
 end;
 
 
+function TPixMapManager.GetSystemExecutableIcon: PtrInt;
+begin
+  Result:= GetMimeIcon('public.unix-executable', gIconsSize);
+end;
+
 function TPixMapManager.GetMimeIcon(AFileExt: String; AIconSize: Integer): PtrInt;
 function TPixMapManager.GetMimeIcon(AFileExt: String; AIconSize: Integer): PtrInt;
 var
 var
   I: Integer;
   I: Integer;
@@ -1826,7 +1832,7 @@ begin
   if FiArcIconID = -1 then
   if FiArcIconID = -1 then
   {$ENDIF}
   {$ENDIF}
   FiArcIconID := AddDefaultThemePixmap('package-x-generic');
   FiArcIconID := AddDefaultThemePixmap('package-x-generic');
-  {$IFDEF MSWINDOWS}
+  {$IF DEFINED(MSWINDOWS) OR DEFINED(DARWIN)}
   FiExeIconID := -1;
   FiExeIconID := -1;
   if gShowIcons > sim_standart then
   if gShowIcons > sim_standart then
     FiExeIconID := GetSystemExecutableIcon;
     FiExeIconID := GetSystemExecutableIcon;
@@ -2387,7 +2393,7 @@ begin
 
 
       if (Extension = '') then
       if (Extension = '') then
       begin
       begin
-        {$IF DEFINED(UNIX) AND NOT (DEFINED(DARWIN) OR DEFINED(HAIKU))}
+        {$IF DEFINED(UNIX) AND NOT DEFINED(HAIKU)}
         if IconsMode = sim_all_and_exe then
         if IconsMode = sim_all_and_exe then
         begin
         begin
           if DirectAccess and (Attributes and S_IXUGO <> 0) then
           if DirectAccess and (Attributes and S_IXUGO <> 0) then
@@ -2395,11 +2401,15 @@ begin
             if not LoadIcon then
             if not LoadIcon then
               Result := -1
               Result := -1
             else begin
             else begin
-              Ext := GioFileGetIcon(FullPath);
-              if Ext = 'application-x-sharedlib' then
-                Result := FiExeIconID
-              else
-                Result := CheckAddThemePixmap(Ext);
+              {$IF DEFINED(DARWIN)}
+                Result := FiExeIconID;
+              {$ELSE}
+                Ext := GioFileGetIcon(FullPath);
+                if Ext = 'application-x-sharedlib' then
+                  Result := FiExeIconID
+                else
+                  Result := CheckAddThemePixmap(Ext);
+              {$ENDIF}
             end;
             end;
             Exit;
             Exit;
           end;
           end;