Bonjour !

Pour savoir si un fichier est un exécutable, sous Linux, y a-t-il mieux que le code suivant ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
uses
  SysUtils, Process;
 
function IsExecutable(const AFileName: string): boolean;
var
  LCommandOutput: ansistring;
begin
  if RunCommand('file', [AFileName], LCommandOutput) then
    result := Pos('executable', LCommandOutput) > 0
  else
    result := FALSE;
end;
 
begin
  WriteLn(IsExecutable('monfichier'));
end.