mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 17:58:03 +02:00
- TFileSearcher: implement property PathSeparator.
- and expose both MaskSeparator and PathSeparator in FindAllFiles() - expose PathSeparator in FindAllDirectories. Issue #0034607. git-svn-id: trunk@59687 -
This commit is contained in:
parent
c864848e53
commit
34803af734
@ -626,12 +626,15 @@ begin
|
||||
end;
|
||||
|
||||
procedure FindAllFiles(AList: TStrings; const SearchPath: String;
|
||||
SearchMask: String; SearchSubDirs: Boolean; DirAttr: Word);
|
||||
SearchMask: String; SearchSubDirs: Boolean; DirAttr: Word;
|
||||
MaskSeparator: char; PathSeparator: char);
|
||||
var
|
||||
Searcher: TListFileSearcher;
|
||||
begin
|
||||
Searcher := TListFileSearcher.Create(AList);
|
||||
Searcher.DirectoryAttribute := DirAttr;
|
||||
Searcher.MaskSeparator := MaskSeparator;
|
||||
Searcher.PathSeparator := PathSeparator;
|
||||
try
|
||||
Searcher.Search(SearchPath, SearchMask, SearchSubDirs);
|
||||
finally
|
||||
@ -640,10 +643,11 @@ begin
|
||||
end;
|
||||
|
||||
function FindAllFiles(const SearchPath: String; SearchMask: String;
|
||||
SearchSubDirs: Boolean; DirAttr: Word): TStringList;
|
||||
SearchSubDirs: Boolean; DirAttr: Word;
|
||||
MaskSeparator: char; PathSeparator: char): TStringList;
|
||||
begin
|
||||
Result := TStringList.Create;
|
||||
FindAllFiles(Result, SearchPath, SearchMask, SearchSubDirs, DirAttr);
|
||||
FindAllFiles(Result, SearchPath, SearchMask, SearchSubDirs, DirAttr, MaskSeparator, PathSeparator);
|
||||
end;
|
||||
|
||||
{ TListDirectoriesSearcher }
|
||||
@ -660,19 +664,20 @@ begin
|
||||
end;
|
||||
|
||||
function FindAllDirectories(const SearchPath : string;
|
||||
SearchSubDirs: Boolean = True): TStringList;
|
||||
SearchSubDirs: Boolean; PathSeparator: char): TStringList;
|
||||
begin
|
||||
Result := TStringList.Create;
|
||||
FindAllDirectories(Result, SearchPath, SearchSubDirs);
|
||||
FindAllDirectories(Result, SearchPath, SearchSubDirs, PathSeparator);
|
||||
end;
|
||||
|
||||
procedure FindAllDirectories(AList: TStrings; const SearchPath: String;
|
||||
SearchSubDirs: Boolean = true);
|
||||
SearchSubDirs: Boolean; PathSeparator: char);
|
||||
var
|
||||
Searcher :TFileSearcher;
|
||||
begin
|
||||
Assert(AList <> nil);
|
||||
Searcher := TListDirectoriesSearcher.Create(AList);
|
||||
Searcher.PathSeparator := PathSeparator;
|
||||
try
|
||||
Searcher.Search(SearchPath, AllFilesMask, SearchSubDirs);
|
||||
finally
|
||||
@ -816,7 +821,7 @@ begin
|
||||
SearchDirectories:=TStringList.Create;
|
||||
try
|
||||
while ASearchPath<>'' do begin
|
||||
p:=Pos(';',ASearchPath);
|
||||
p:=Pos(FPathSeparator,ASearchPath);
|
||||
if p<1 then
|
||||
p:=length(ASearchPath)+1;
|
||||
Dir:=TrimFilename(LeftStr(ASearchPath,p-1));
|
||||
|
@ -120,6 +120,7 @@ type
|
||||
TFileSearcher = class(TFileIterator)
|
||||
private
|
||||
FMaskSeparator: char;
|
||||
FPathSeparator: char;
|
||||
FFollowSymLink: Boolean;
|
||||
FOnFileFound: TFileFoundEvent;
|
||||
FOnDirectoryFound: TDirectoryFoundEvent;
|
||||
@ -137,6 +138,7 @@ type
|
||||
ASearchSubDirs: Boolean = True; CaseSensitive: Boolean = False);
|
||||
public
|
||||
property MaskSeparator: char read FMaskSeparator write FMaskSeparator;
|
||||
property PathSeparator: char read FPathSeparator write FPathSeparator;
|
||||
property FollowSymLink: Boolean read FFollowSymLink write FFollowSymLink;
|
||||
property FileAttribute: Word read FFileAttribute write FFileAttribute default faAnyfile;
|
||||
property DirectoryAttribute: Word read FDirectoryAttribute write FDirectoryAttribute default faDirectory;
|
||||
@ -168,14 +170,16 @@ type
|
||||
end;
|
||||
|
||||
function FindAllFiles(const SearchPath: String; SearchMask: String = '';
|
||||
SearchSubDirs: Boolean = True; DirAttr: Word = faDirectory): TStringList; overload;
|
||||
SearchSubDirs: Boolean = True; DirAttr: Word = faDirectory;
|
||||
MaskSeparator: char = ';'; PathSeparator: char = ';'): TStringList; overload;
|
||||
procedure FindAllFiles(AList: TStrings; const SearchPath: String;
|
||||
SearchMask: String = ''; SearchSubDirs: Boolean = True; DirAttr: Word = faDirectory); overload;
|
||||
SearchMask: String = ''; SearchSubDirs: Boolean = True; DirAttr: Word = faDirectory;
|
||||
MaskSeparator: char = ';'; PathSeparator: char = ';'); overload;
|
||||
|
||||
function FindAllDirectories(const SearchPath: string;
|
||||
SearchSubDirs: Boolean = True): TStringList; overload;
|
||||
SearchSubDirs: Boolean = True; PathSeparator: char = ';'): TStringList; overload;
|
||||
procedure FindAllDirectories(AList: TStrings; const SearchPath: String;
|
||||
SearchSubDirs: Boolean = true); overload;
|
||||
SearchSubDirs: Boolean = true; PathSeparator: char = ';'); overload;
|
||||
|
||||
// flags for copy
|
||||
type
|
||||
|
Loading…
Reference in New Issue
Block a user