unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, LazFileUtils;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
Var
F : Longint;
FStr : string;
begin
FStr := 'Permissions: ';
Label1.Caption := 'File: ';
Label2.Caption := FStr;
with TOpenDialog.Create(Self) do
begin
if Execute then
begin
Filter := '*.*';
Label1.Caption := 'File: ' + FileName;
F := FileGetAttrUTF8(FileName);
If F<>-1 then
begin
If (F and faReadOnly)<>0 then
FStr := FStr + '-ReadOnly-';
If (F and faHidden)<>0 then
FStr := FStr + '-Hidden-';
If (F and faSysFile)<>0 then
FStr := FStr + '-System File-';
If (F and faVolumeID)<>0 then
FStr := FStr + '-disk label-';
If (F and faArchive)<>0 then
FStr := FStr + '-archive-';
If (F and faDirectory)<>0 then
FStr := FStr + '-directory-';
Label2.Caption := FStr;
end
else
Writeln ('Error reading attributes of ', Name);
end;
Free;
end;
end;
end.