sysdir.inc 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2020 by Free Pascal development team
  4. Low level directory functions for the Sinclair QL
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {*****************************************************************************
  12. Directory Handling
  13. *****************************************************************************}
  14. procedure do_mkdir(const s : rawbytestring);
  15. var
  16. chanId: tchanid;
  17. errCode: longint;
  18. begin
  19. { The QL needs a open file handle on which to create a
  20. directory. The file should be opened as a new file as
  21. errors occur if the file exists when creating a new
  22. directory when it's already there. }
  23. chanId := io_open(PAnsiChar(s), Q_OPEN_OVER);
  24. if chanId < 0 then
  25. begin
  26. Error2InOutRes(chanId);
  27. exit;
  28. end;
  29. { Convert the opened file to a directory. }
  30. errCode := iof_mkdr(chanId);
  31. { Close the file/directory. No errors occur. }
  32. io_close(chanId);
  33. { Check if the mkdir actually worked. }
  34. if errCode < 0 then
  35. Error2InOutRes(errCode);
  36. end;
  37. procedure do_rmdir(const s : rawbytestring);
  38. begin
  39. { Deleting a directory is as simple as deleting
  40. a file. There must be no files in the directory
  41. though. However, SMSQ seems to return zero for a file
  42. or directory name that is not present. It should return
  43. ERR_NF. (At least on RAM_/FLP_ or WIN_)
  44. }
  45. Error2InOutRes(io_delet(PAnsiChar(s)));
  46. end;
  47. procedure do_ChDir(const s: rawbytestring);
  48. begin
  49. end;
  50. procedure do_GetDir (DriveNr: byte; var Dir: RawByteString);
  51. begin
  52. end;