소스 검색

sinclairql: do_mkdir implemented, patch by Norman Dunbar

git-svn-id: trunk@49173 -
Károly Balogh 4 년 전
부모
커밋
9432aa4b69
2개의 변경된 파일24개의 추가작업 그리고 0개의 파일을 삭제
  1. 23 0
      rtl/sinclairql/sysdir.inc
  2. 1 0
      rtl/sinclairql/sysos.inc

+ 23 - 0
rtl/sinclairql/sysdir.inc

@@ -18,7 +18,30 @@
                            Directory Handling
 *****************************************************************************}
 procedure do_mkdir(const s : rawbytestring);
+var
+  chanId: tchanid;
+  errCode: longint;
 begin
+  { The QL needs a open file handle on which to create a
+    directory. The file should be opened as a new file as
+    errors occur if the file exists when creating a new
+    directory when it's already there. }
+  chanId := io_open(PChar(s), Q_OPEN_OVER);
+  if chanId < 0 then
+    begin
+      Error2InOutRes(chanId); 
+      exit;
+    end;
+
+  { Convert the opened file to a directory. }
+  errCode := iof_mkdir(chanId);
+
+  { Close the file/directory. No errors occur. }
+  io_close(chanId);
+
+  { Check if the mkdir actually worked. }
+  if errCode < 0 then
+    Error2InOutRes(errCode);
 end;
 
 

+ 1 - 0
rtl/sinclairql/sysos.inc

@@ -16,6 +16,7 @@
  **********************************************************************}
 
 {$i qdos.inc}
+{$i sms.inc}
 
 procedure Error2InOutRes(errno: longint);
 begin