mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-25 17:21:45 +02:00
* FSearch with given path corrected
This commit is contained in:
parent
c0ec0e97c9
commit
103c1d2d52
109
rtl/os2/dos.pas
109
rtl/os2/dos.pas
@ -183,50 +183,74 @@ var i,p1:longint;
|
|||||||
ND: PathStr;
|
ND: PathStr;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{No wildcards allowed in these things:}
|
{ check if the file specified exists }
|
||||||
if (pos('?',path)<>0) or (pos('*',path)<>0) then
|
if OS_Mode = osOS2 then
|
||||||
fsearch:=''
|
begin
|
||||||
|
New (FStat);
|
||||||
|
ND := NewDir + Path;
|
||||||
|
Handle := $FFFFFFFF;
|
||||||
|
Count := 1;
|
||||||
|
RC := DosFindFirst (ND, Handle, $37, FStat, SizeOf (FStat^),
|
||||||
|
Count, ilStandard);
|
||||||
|
DosFindClose (Handle);
|
||||||
|
Dispose (FStat);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{ allow slash as backslash }
|
FindFirst (path,anyfile,s);
|
||||||
for i:=1 to length(dirlist) do
|
FindClose (s);
|
||||||
if dirlist[i]='/' then dirlist[i]:='\';
|
RC := DosError;
|
||||||
repeat
|
end;
|
||||||
p1:=pos(';',dirlist);
|
if RC = 0 then
|
||||||
if p1<>0 then
|
FSearch := Path
|
||||||
begin
|
else
|
||||||
newdir:=copy(dirlist,1,p1-1);
|
begin
|
||||||
delete(dirlist,1,p1);
|
{No wildcards allowed in these things:}
|
||||||
end
|
if (pos('?',path)<>0) or (pos('*',path)<>0) then
|
||||||
else
|
fsearch:=''
|
||||||
begin
|
else
|
||||||
newdir:=dirlist;
|
|
||||||
dirlist:='';
|
|
||||||
end;
|
|
||||||
if (newdir<>'') and
|
|
||||||
not (newdir[length(newdir)] in ['\',':']) then
|
|
||||||
newdir:=newdir+'\';
|
|
||||||
if OS_Mode = osOS2 then
|
|
||||||
begin
|
begin
|
||||||
New (FStat);
|
{ allow slash as backslash }
|
||||||
ND := NewDir + Path;
|
for i:=1 to length(dirlist) do
|
||||||
Handle := $FFFFFFFF;
|
if dirlist[i]='/' then dirlist[i]:='\';
|
||||||
Count := 1;
|
repeat
|
||||||
RC := DosFindFirst (ND, Handle, $37, FStat, SizeOf (FStat^),
|
p1:=pos(';',dirlist);
|
||||||
Count, ilStandard);
|
if p1<>0 then
|
||||||
DosFindClose (Handle);
|
begin
|
||||||
Dispose (FStat);
|
newdir:=copy(dirlist,1,p1-1);
|
||||||
end else
|
delete(dirlist,1,p1);
|
||||||
begin
|
end
|
||||||
findfirst(newdir+path,anyfile,s);
|
else
|
||||||
RC := DosError;
|
begin
|
||||||
|
newdir:=dirlist;
|
||||||
|
dirlist:='';
|
||||||
|
end;
|
||||||
|
if (newdir<>'') and
|
||||||
|
not (newdir[length(newdir)] in ['\',':']) then
|
||||||
|
newdir:=newdir+'\';
|
||||||
|
if OS_Mode = osOS2 then
|
||||||
|
begin
|
||||||
|
New (FStat);
|
||||||
|
ND := NewDir + Path;
|
||||||
|
Handle := $FFFFFFFF;
|
||||||
|
Count := 1;
|
||||||
|
RC := DosFindFirst (ND, Handle, $37, FStat,
|
||||||
|
SizeOf (FStat^), Count, ilStandard);
|
||||||
|
DosFindClose (Handle);
|
||||||
|
Dispose (FStat);
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
FindFirst (newdir+path,anyfile,s);
|
||||||
|
RC := DosError;
|
||||||
|
FindClose (S);
|
||||||
|
end;
|
||||||
|
if RC = 0 then
|
||||||
|
newdir:=newdir+path
|
||||||
|
else
|
||||||
|
newdir:='';
|
||||||
|
until (dirlist='') or (newdir<>'');
|
||||||
|
fsearch:=newdir;
|
||||||
end;
|
end;
|
||||||
if RC = 0 then
|
|
||||||
newdir:=newdir+path
|
|
||||||
else
|
|
||||||
newdir:='';
|
|
||||||
until (dirlist='') or (newdir<>'');
|
|
||||||
fsearch:=newdir;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1001,7 +1025,10 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.22 2000-03-12 18:32:17 hajny
|
Revision 1.23 2000-04-18 20:30:02 hajny
|
||||||
|
* FSearch with given path corrected
|
||||||
|
|
||||||
|
Revision 1.22 2000/03/12 18:32:17 hajny
|
||||||
* missing parentheses added
|
* missing parentheses added
|
||||||
|
|
||||||
Revision 1.21 2000/03/05 19:00:37 hajny
|
Revision 1.21 2000/03/05 19:00:37 hajny
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user