* Avoid warnings about pointer to signed integers typecasts

+ Accept on trailing directory seperator for DirectoryExists
    and handle 'X:' directory separately by calling
    GetDir(drive,dir) to find the current directory of the drive
    considered.

git-svn-id: trunk@18176 -
This commit is contained in:
pierre 2011-08-12 08:35:55 +00:00
parent 9fff19cda9
commit 9d763ec052

View File

@ -166,7 +166,7 @@ begin
Result:=-1;
exit;
end;
syscopyfromdos(Longint(@Buffer)+readsize,lo(regs.realeax));
syscopyfromdos(Longint(dword(@Buffer)+readsize),lo(regs.realeax));
inc(readsize,lo(regs.realeax));
dec(Count,lo(regs.realeax));
{ stop when not the specified size is read }
@ -190,7 +190,7 @@ begin
size:=tb_size
else
size:=Count;
syscopytodos(Longint(@Buffer)+writesize,size);
syscopytodos(Longint(dword(@Buffer)+writesize),size);
regs.realecx:=size;
regs.realedx:=tb_offset;
regs.realds:=tb_segment;
@ -303,8 +303,40 @@ end;
Function DirectoryExists (Const Directory : String) : Boolean;
Var
Sr : Searchrec;
Dir : String;
drive : byte;
StoredIORes : longint;
begin
DOS.FindFirst(Directory,$3f,sr);
Dir:=Directory;
if (length(dir)=2) and (dir[2]=':') and
((dir[1] in ['A'..'Z']) or (dir[1] in ['a'..'z'])) then
begin
{ We want to test GetCurDir }
if dir[1] in ['A'..'Z'] then
drive:=ord(dir[1])-ord('A')+1
else
drive:=ord(dir[1])-ord('a')+1;
{$undef OPT_I}
{$ifopt I+}
{$define OPT_I}
{$endif}
{$I-}
StoredIORes:=InOutRes;
InOutRes:=0;
GetDir(drive,dir);
if InOutRes <> 0 then
begin
InOutRes:=StoredIORes;
result:=false;
exit;
end;
end;
{$ifdef OPT_I}
{$I+}
{$endif}
if (length(dir)>1) and (dir[length(dir)] in ['/','\']) then
dir:=copy(dir,1,length(dir)-1);
DOS.FindFirst(Dir,$3f,sr);
if DosError = 0 then
begin
Result:=(sr.attr and $10)=$10;