Use AllFilesMask fro RTL or define it

git-svn-id: trunk@8550 -
This commit is contained in:
pierre 2007-09-18 14:33:58 +00:00
parent 5a0ec1105d
commit d7a1ec8e49

View File

@ -23,9 +23,6 @@ unit cfileutl;
{$i fpcdefs.inc} {$i fpcdefs.inc}
{$ifndef go32v2}
{$define usedircache}
{$endif not go32v2}
interface interface
@ -131,6 +128,29 @@ implementation
Comphook, Comphook,
Globals; Globals;
{$undef AllFilesMaskIsInRTL}
{$if (FPC_VERSION > 2)}
{$define AllFilesMaskIsInRTL}
{$endif FPC_VERSION}
{$if (FPC_VERSION = 2) and (FPC_RELEASE > 2)}
{$define AllFilesMaskIsInRTL}
{$endif}
{$if (FPC_VERSION = 2) and (FPC_RELEASE = 2) and (FPC_PATCH > 0)}
{$define AllFilesMaskIsInRTL}
{$endif}
{$ifndef AllFilesMaskIsInRTL}
{$if defined(go32v2) or defined(watcom)}
const
AllFilesMask = '*.*';
{$else}
const
AllFilesMask = '*';
{$endif not (go32v2 or watcom)}
{$endif not AllFilesMaskIsInRTL}
var var
DirCache : TDirectoryCache; DirCache : TDirectoryCache;
@ -175,7 +195,7 @@ implementation
entry:=PCachedDirectoryEntry(DirectoryEntries.Find(Lower(AName))); entry:=PCachedDirectoryEntry(DirectoryEntries.Find(Lower(AName)));
if assigned(entry) then if assigned(entry) then
Result:=entry^.Attr Result:=entry^.Attr
else else
Result:=0; Result:=0;
end end
else else
@ -192,7 +212,7 @@ implementation
begin begin
FreeDirectoryEntries; FreeDirectoryEntries;
DirectoryEntries.Clear; DirectoryEntries.Clear;
if findfirst(IncludeTrailingPathDelimiter(Name)+'*',faAnyFile or faDirectory,dir) = 0 then if findfirst(IncludeTrailingPathDelimiter(Name)+AllFilesMask,faAnyFile or faDirectory,dir) = 0 then
begin begin
repeat repeat
if ((dir.attr and faDirectory)<>faDirectory) or if ((dir.attr and faDirectory)<>faDirectory) or
@ -243,7 +263,7 @@ implementation
Attr:=entry^.Attr; Attr:=entry^.Attr;
FoundName:=entry^.RealName FoundName:=entry^.RealName
end end
else else
Attr:=0; Attr:=0;
if Attr<>0 then if Attr<>0 then
Result:=((Attr and faDirectory)=0) Result:=((Attr and faDirectory)=0)
@ -956,7 +976,7 @@ implementation
suffix:=Copy(currpath,staridx+1,length(currpath)); suffix:=Copy(currpath,staridx+1,length(currpath));
subdirfound:=false; subdirfound:=false;
{$ifdef usedircache} {$ifdef usedircache}
if DirCache.FindFirst(Prefix+'*',dir) then if DirCache.FindFirst(Prefix+AllFilesMask,dir) then
begin begin
repeat repeat
if (dir.attr and faDirectory)<>0 then if (dir.attr and faDirectory)<>0 then
@ -974,7 +994,7 @@ implementation
end; end;
DirCache.FindClose(dir); DirCache.FindClose(dir);
{$else usedircache} {$else usedircache}
if findfirst(prefix+'*',faDirectory,dir) = 0 then if findfirst(prefix+AllFilesMask,faDirectory,dir) = 0 then
begin begin
repeat repeat
if (dir.name<>'.') and if (dir.name<>'.') and
@ -1105,7 +1125,7 @@ implementation
while (pc^<>PathSeparator) and (pc^<>';') and (pc^<>#0) do while (pc^<>PathSeparator) and (pc^<>';') and (pc^<>#0) do
inc(pc); inc(pc);
SetLength(singlepathstring, pc-startpc); SetLength(singlepathstring, pc-startpc);
move(startpc^,singlepathstring[1],pc-startpc); move(startpc^,singlepathstring[1],pc-startpc);
singlepathstring:=FixPath(ExpandFileName(singlepathstring),false); singlepathstring:=FixPath(ExpandFileName(singlepathstring),false);
result:=FileExistsNonCase(singlepathstring,f,allowcache,FoundFile); result:=FileExistsNonCase(singlepathstring,f,allowcache,FoundFile);
if result then if result then