summaryrefslogtreecommitdiff
path: root/compiler/cfileutl.pas
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2007-07-01 14:31:56 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2007-07-01 14:31:56 +0000
commitdb6fc3f29669df7f4d6f4a9c2b3730fa51d3caa3 (patch)
tree211c8b45dee6e95b5c573fd5644c8c63c6194a32 /compiler/cfileutl.pas
parent035c3b8580dd93ff2b95885a66eeb72955727eea (diff)
downloadfpc-db6fc3f29669df7f4d6f4a9c2b3730fa51d3caa3.tar.gz
* 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: http://svn.freepascal.org/svn/fpc/trunk@7903 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/cfileutl.pas')
-rw-r--r--compiler/cfileutl.pas24
1 files changed, 19 insertions, 5 deletions
diff --git a/compiler/cfileutl.pas b/compiler/cfileutl.pas
index 3e7796df19..9288a3b17a 100644
--- a/compiler/cfileutl.pas
+++ b/compiler/cfileutl.pas
@@ -194,8 +194,8 @@ implementation
begin
repeat
if ((dir.attr and faDirectory)<>faDirectory) or
- (dir.Name<>'.') or
- (dir.Name<>'..') then
+ ((dir.Name<>'.') and
+ (dir.Name<>'..')) then
begin
if not(tf_files_case_sensitive 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;
+ var
+ entry: PCachedDirectoryEntry;
begin
if Res.EntryIndex<Res.CachedDir.DirectoryEntries.Count then
begin
- Res.Name:=Res.CachedDir.DirectoryEntries.NameOfIndex(Res.EntryIndex);
- Res.Attr:=PtrInt(Res.CachedDir.DirectoryEntries[Res.EntryIndex]);
+ 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
+ Res.Name:=Res.CachedDir.DirectoryEntries.NameOfIndex(Res.EntryIndex);
+ Res.Attr:=PtrInt(Res.CachedDir.DirectoryEntries[Res.EntryIndex]);
+ end;
inc(Res.EntryIndex);
Result:=true;
end
@@ -510,7 +521,10 @@ implementation
begin
result:=DirCache.FileExistsCaseAware(FoundFile,fn2);
if result then
- exit
+ begin
+ FoundFile:=fn2;
+ exit;
+ end;
end
else
{$endif usedircache}