mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: Find files - exclude directories with absolute path
This commit is contained in:
parent
6361f6577b
commit
cb15de0993
3 changed files with 18 additions and 11 deletions
|
|
@ -272,7 +272,7 @@ begin
|
|||
if AFile.IsDirectory or AFile.IsLinkToDirectory then
|
||||
begin
|
||||
Matches := CheckDirectoryName(FFileChecks, aFile.Name) and
|
||||
CheckDirectoryNameRelative(FFileChecks, aFile.FullPath, FRootDir);
|
||||
CheckDirectoryNameEx(FFileChecks, aFile.FullPath, FRootDir);
|
||||
end
|
||||
else begin
|
||||
Matches := CheckFile(FFileTemplate.SearchRecord, FFileChecks, aFile);
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ type
|
|||
|
||||
function CheckPlugin(const SearchTemplate: TSearchTemplateRec; const FileName: String) : Boolean;
|
||||
function CheckDirectoryName(const FileChecks: TFindFileChecks; const DirectoryName: String) : Boolean;
|
||||
function CheckDirectoryNameRelative(const FileChecks: TFindFileChecks; const FullPath, BasePath: String) : Boolean;
|
||||
function CheckDirectoryNameEx(const FileChecks: TFindFileChecks; const FullPath, BasePath: String) : Boolean;
|
||||
function CheckFileName(const FileChecks: TFindFileChecks; const FileName: String) : Boolean;
|
||||
function CheckFileTime(const FileChecks: TFindFileChecks; FT : TFileTime) : Boolean; inline;
|
||||
function CheckFileDateTime(const FileChecks: TFindFileChecks; DT : TDateTime) : Boolean;
|
||||
|
|
@ -426,7 +426,7 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function CheckDirectoryNameRelative(const FileChecks: TFindFileChecks; const FullPath, BasePath: String): Boolean;
|
||||
function CheckDirectoryNameEx(const FileChecks: TFindFileChecks; const FullPath, BasePath: String): Boolean;
|
||||
var
|
||||
APath: String;
|
||||
begin
|
||||
|
|
@ -435,11 +435,18 @@ begin
|
|||
begin
|
||||
for APath in ExcludeDirectories.Split([';'], TStringSplitOptions.ExcludeEmpty) do
|
||||
begin
|
||||
// Check if FullPath is a path relative to BasePath.
|
||||
if GetPathType(APath) = ptRelative then
|
||||
begin
|
||||
if MatchesMask(ExtractDirLevel(BasePath, FullPath), APath) then
|
||||
Exit(False);
|
||||
case GetPathType(APath) of
|
||||
ptRelative:
|
||||
begin
|
||||
// Check if FullPath is a path relative to BasePath.
|
||||
if MatchesMask(ExtractDirLevel(BasePath, FullPath), APath) then
|
||||
Exit(False);
|
||||
end;
|
||||
ptAbsolute:
|
||||
begin
|
||||
if MatchesMask(FullPath, APath) then
|
||||
Exit(False);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -320,9 +320,9 @@ begin
|
|||
with FSearchTemplate do
|
||||
begin
|
||||
Result := CheckDirectoryName(FolderName) and
|
||||
CheckDirectoryNameRelative(FFileChecks,
|
||||
CurrentDir + PathDelim + FolderName,
|
||||
FSearchTemplate.StartPath);
|
||||
CheckDirectoryNameEx(FFileChecks,
|
||||
CurrentDir + PathDelim + FolderName,
|
||||
FSearchTemplate.StartPath);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue