Ignore:
Timestamp:
Sep 10, 2022, 6:54:43 PM (20 months ago)
Author:
chronos
Message:
  • Modified: CoolTranslator replaced by Common package.
  • Modified: Update common package.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/UFindFile.pas

    r15 r25  
    2424
    2525uses
    26   SysUtils, Classes, Graphics, Controls, Forms, Dialogs, FileCtrl;
     26  SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
    2727
    2828type
     
    3535  private
    3636    s : TStringList;
    37 
    3837    fSubFolder : boolean;
    3938    fAttr: TFileAttrib;
    4039    fPath : string;
    4140    fFileMask : string;
    42 
    4341    procedure SetPath(Value: string);
    4442    procedure FileSearch(const inPath : string);
     
    4644    constructor Create(AOwner: TComponent); override;
    4745    destructor Destroy; override;
    48 
    4946    function SearchForFiles: TStringList;
    5047  published
     
    5956  FilterAll = '*.*';
    6057{$ENDIF}
    61 {$IFDEF LINUX}
     58{$IFDEF UNIX}
    6259  FilterAll = '*';
    6360{$ENDIF}
    6461
    6562procedure Register;
     63
    6664
    6765implementation
     
    8785begin
    8886  s.Free;
    89   inherited Destroy;
     87  inherited;
    9088end;
    9189
     
    117115  Attr := 0;
    118116  if ffaReadOnly in FileAttr then Attr := Attr + faReadOnly;
    119   if ffaHidden in FileAttr then Attr := Attr + faHidden;
    120   if ffaSysFile in FileAttr then Attr := Attr + faSysFile;
    121   if ffaVolumeID in FileAttr then Attr := Attr + faVolumeID;
     117  if ffaHidden in FileAttr then Attr := Attr + 2; //faHidden; use constant to avoid platform warning
     118  if ffaSysFile in FileAttr then Attr := Attr + 4; //faSysFile; use constant to avoid platform warning
     119  // Deprecated: if ffaVolumeID in FileAttr then Attr := Attr + faVolumeID;
    122120  if ffaDirectory in FileAttr then Attr := Attr + faDirectory;
    123121  if ffaArchive in FileAttr then Attr := Attr + faArchive;
    124122  if ffaAnyFile in FileAttr then Attr := Attr + faAnyFile;
    125123
    126   if SysUtils.FindFirst(UTF8Decode(inPath + FileMask), Attr, Rec) = 0 then
     124  if SysUtils.FindFirst(inPath + FileMask, Attr, Rec) = 0 then
    127125  try
    128126    repeat
    129       s.Add(inPath + UTF8Encode(Rec.Name));
     127      s.Add(inPath + Rec.Name);
    130128    until SysUtils.FindNext(Rec) <> 0;
    131129  finally
     
    135133  If not InSubFolders then Exit;
    136134
    137   if SysUtils.FindFirst(UTF8Decode(inPath + FilterAll), faDirectory, Rec) = 0 then
     135  if SysUtils.FindFirst(inPath + FilterAll, faDirectory, Rec) = 0 then
    138136  try
    139137    repeat
    140138      if ((Rec.Attr and faDirectory) > 0) and (Rec.Name <> '.')
    141139      and (Rec.Name <> '..') then
    142         FileSearch(IncludeTrailingBackslash(inPath + UTF8Encode(Rec.Name)));
     140        FileSearch(IncludeTrailingBackslash(inPath + Rec.Name));
    143141    until SysUtils.FindNext(Rec) <> 0;
    144142  finally
Note: See TracChangeset for help on using the changeset viewer.