sysdir.inc 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2004-2011 by Armin Diehl
  4. FPC Pascal system unit for the netware API.
  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(s: rawbytestring);
  15. var
  16. Rc : longint;
  17. begin
  18. DoDirSeparators(s);
  19. Rc := _mkdir(pchar(s));
  20. if Rc <> 0 then
  21. SetFileError (Rc);
  22. end;
  23. procedure do_RmDir(s: rawbytestring);
  24. var Rc : longint;
  25. begin
  26. if s = '.' then
  27. begin
  28. InOutRes := 16;
  29. exit;
  30. end;
  31. DoDirSeparators(s);
  32. Rc := _rmdir(pchar(s));
  33. if Rc <> 0 then
  34. SetFileError(Rc);
  35. end;
  36. procedure do_ChDir(s: rawbytestring);
  37. var RC: longint;
  38. begin
  39. DoDirSeparators(s);
  40. RC := _chdir (pchar(s));
  41. if Rc <> 0 then
  42. SetFileError(Rc);
  43. end;
  44. procedure do_getdir(drivenr : byte;var dir : rawbytestring);
  45. VAR P : ARRAY [0..255] OF CHAR;
  46. i : LONGINT;
  47. begin
  48. P[0] := #0;
  49. _getcwd (@P, SIZEOF (P));
  50. i := _strlen (P);
  51. if i > 0 then
  52. begin
  53. SetLength (dir, i);
  54. Move (P, dir[1], i);
  55. DoDirSeparators(dir);
  56. // fix / after volume, the compiler needs that
  57. // normaly root of a volumes is SERVERNAME/SYS:, change that
  58. // to SERVERNAME/SYS:/
  59. i := pos (':',dir);
  60. if (i > 0) then
  61. if i = Length (dir) then dir := dir + '/' else
  62. if dir [i+1] <> '/' then insert ('/',dir,i+1);
  63. SetCodePage (dir,DefaultFileSystemCodePage,false);
  64. END ELSE
  65. InOutRes := 1;
  66. end;