mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 21:49:15 +02:00
* fixed check for not adding "." and ".." to dircache
* adapted TDirectoryCache.FindNext for new case-aware code * fixed bug in FileExistsNonCase (previous revision's fix was not complete) git-svn-id: trunk@7903 -
This commit is contained in:
parent
5e24870b8b
commit
f5beba1eeb
@ -194,8 +194,8 @@ implementation
|
|||||||
begin
|
begin
|
||||||
repeat
|
repeat
|
||||||
if ((dir.attr and faDirectory)<>faDirectory) or
|
if ((dir.attr and faDirectory)<>faDirectory) or
|
||||||
(dir.Name<>'.') or
|
((dir.Name<>'.') and
|
||||||
(dir.Name<>'..') then
|
(dir.Name<>'..')) then
|
||||||
begin
|
begin
|
||||||
if not(tf_files_case_sensitive in source_info.flags) then
|
if not(tf_files_case_sensitive in source_info.flags) then
|
||||||
if (tf_files_case_aware in source_info.flags) then
|
if (tf_files_case_aware in source_info.flags) then
|
||||||
@ -353,11 +353,22 @@ implementation
|
|||||||
|
|
||||||
|
|
||||||
function TDirectoryCache.FindNext(var Res:TCachedSearchRec):boolean;
|
function TDirectoryCache.FindNext(var Res:TCachedSearchRec):boolean;
|
||||||
|
var
|
||||||
|
entry: PCachedDirectoryEntry;
|
||||||
begin
|
begin
|
||||||
if Res.EntryIndex<Res.CachedDir.DirectoryEntries.Count then
|
if Res.EntryIndex<Res.CachedDir.DirectoryEntries.Count then
|
||||||
|
begin
|
||||||
|
if (tf_files_case_aware in source_info.flags) then
|
||||||
|
begin
|
||||||
|
entry:=Res.CachedDir.DirectoryEntries[Res.EntryIndex];
|
||||||
|
Res.Name:=entry^.RealName;
|
||||||
|
Res.Attr:=entry^.Attr;
|
||||||
|
end
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
Res.Name:=Res.CachedDir.DirectoryEntries.NameOfIndex(Res.EntryIndex);
|
Res.Name:=Res.CachedDir.DirectoryEntries.NameOfIndex(Res.EntryIndex);
|
||||||
Res.Attr:=PtrInt(Res.CachedDir.DirectoryEntries[Res.EntryIndex]);
|
Res.Attr:=PtrInt(Res.CachedDir.DirectoryEntries[Res.EntryIndex]);
|
||||||
|
end;
|
||||||
inc(Res.EntryIndex);
|
inc(Res.EntryIndex);
|
||||||
Result:=true;
|
Result:=true;
|
||||||
end
|
end
|
||||||
@ -510,7 +521,10 @@ implementation
|
|||||||
begin
|
begin
|
||||||
result:=DirCache.FileExistsCaseAware(FoundFile,fn2);
|
result:=DirCache.FileExistsCaseAware(FoundFile,fn2);
|
||||||
if result then
|
if result then
|
||||||
exit
|
begin
|
||||||
|
FoundFile:=fn2;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
{$endif usedircache}
|
{$endif usedircache}
|
||||||
|
Loading…
Reference in New Issue
Block a user