Changeset 75 for trunk/Packages/Common/FindFile.pas
- Timestamp:
- Jun 4, 2024, 12:22:49 AM (5 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/FindFile.pas
r74 r75 19 19 } 20 20 21 unit UFindFile;21 unit FindFile; 22 22 23 23 interface 24 24 25 25 uses 26 SysUtils, Classes, Graphics, Controls, Forms, Dialogs , FileCtrl;26 SysUtils, Classes, Graphics, Controls, Forms, Dialogs; 27 27 28 28 type … … 35 35 private 36 36 s : TStringList; 37 38 37 fSubFolder : boolean; 39 38 fAttr: TFileAttrib; 40 39 fPath : string; 41 40 fFileMask : string; 42 43 41 procedure SetPath(Value: string); 44 42 procedure FileSearch(const inPath : string); … … 46 44 constructor Create(AOwner: TComponent); override; 47 45 destructor Destroy; override; 48 49 46 function SearchForFiles: TStringList; 50 47 published … … 55 52 end; 56 53 54 const 55 {$IFDEF WINDOWS} 56 FilterAll = '*.*'; 57 {$ENDIF} 58 {$IFDEF UNIX} 59 FilterAll = '*'; 60 {$ENDIF} 61 57 62 procedure Register; 63 58 64 59 65 implementation … … 71 77 inherited Create(AOwner); 72 78 Path := IncludeTrailingBackslash(UTF8Encode(GetCurrentDir)); 73 FileMask := '*.*';79 FileMask := FilterAll; 74 80 FileAttr := [ffaAnyFile]; 75 81 s := TStringList.Create; … … 79 85 begin 80 86 s.Free; 81 inherited Destroy;87 inherited; 82 88 end; 83 89 … … 109 115 Attr := 0; 110 116 if ffaReadOnly in FileAttr then Attr := Attr + faReadOnly; 111 if ffaHidden in FileAttr then Attr := Attr + faHidden;112 if ffaSysFile in FileAttr then Attr := Attr + faSysFile;113 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; 114 120 if ffaDirectory in FileAttr then Attr := Attr + faDirectory; 115 121 if ffaArchive in FileAttr then Attr := Attr + faArchive; 116 122 if ffaAnyFile in FileAttr then Attr := Attr + faAnyFile; 117 123 118 if SysUtils.FindFirst( UTF8Decode(inPath + FileMask), Attr, Rec) = 0 then124 if SysUtils.FindFirst(inPath + FileMask, Attr, Rec) = 0 then 119 125 try 120 126 repeat 121 s.Add(inPath + UTF8Encode(Rec.Name));127 s.Add(inPath + Rec.Name); 122 128 until SysUtils.FindNext(Rec) <> 0; 123 129 finally … … 127 133 If not InSubFolders then Exit; 128 134 129 if SysUtils.FindFirst( UTF8Decode(inPath + '*.*'), faDirectory, Rec) = 0 then135 if SysUtils.FindFirst(inPath + FilterAll, faDirectory, Rec) = 0 then 130 136 try 131 137 repeat 132 138 if ((Rec.Attr and faDirectory) > 0) and (Rec.Name <> '.') 133 139 and (Rec.Name <> '..') then 134 FileSearch(IncludeTrailingBackslash(inPath + UTF8Encode(Rec.Name)));140 FileSearch(IncludeTrailingBackslash(inPath + Rec.Name)); 135 141 until SysUtils.FindNext(Rec) <> 0; 136 142 finally 137 143 SysUtils.FindClose(Rec); 138 144 end; 139 end; 145 end; 140 146 141 147 end. 142
Note:
See TracChangeset
for help on using the changeset viewer.