瀏覽代碼

atari: implemented some more bits of sysutils

git-svn-id: trunk@35200 -
Károly Balogh 8 年之前
父節點
當前提交
2199f2a65e
共有 1 個文件被更改,包括 23 次插入4 次删除
  1. 23 4
      rtl/atari/sysutils.pp

+ 23 - 4
rtl/atari/sysutils.pp

@@ -217,8 +217,15 @@ end;
 
 
 
 
 function FileExists (const FileName : RawByteString) : Boolean;
 function FileExists (const FileName : RawByteString) : Boolean;
+var
+  Attr: longint;
 begin
 begin
-  result:=false;
+  FileExists:=false;
+  Attr:=FileGetAttr(FileName);
+  if Attr < 0 then
+    exit;
+
+  result:=(Attr and (faVolumeID or faDirectory)) = 0;
 end;
 end;
 
 
 
 
@@ -317,13 +324,18 @@ end;
 
 
 Function FileGetAttr (Const FileName : RawByteString) : Longint;
 Function FileGetAttr (Const FileName : RawByteString) : Longint;
 begin
 begin
-  FileGetAttr := -1
+  FileGetAttr:=gemdos_fattrib(pchar(FileName),0,0);
 end;
 end;
 
 
 
 
 Function FileSetAttr (Const Filename : RawByteString; Attr: longint) : Longint;
 Function FileSetAttr (Const Filename : RawByteString; Attr: longint) : Longint;
 begin
 begin
-  FileSetAttr := -1;
+  FileSetAttr:=gemdos_fattrib(pchar(FileName),1,Attr and faAnyFile);
+
+  if FileSetAttr < -1 then
+    FileSetAttr:=-1
+  else
+    FileSetAttr:=0;
 end;
 end;
 
 
 
 
@@ -361,8 +373,15 @@ begin
 end;
 end;
 
 
 function DirectoryExists(const Directory: RawByteString): Boolean;
 function DirectoryExists(const Directory: RawByteString): Boolean;
+var
+  Attr: longint;
 begin
 begin
-  result:=false;
+  DirectoryExists:=false;
+  Attr:=FileGetAttr(Directory);
+  if Attr < 0 then
+    exit;
+
+  result:=(Attr and faDirectory) <> 0;
 end;
 end;