nodejsfs.pas 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. {
  2. This file is part of the Pas2JS run time library.
  3. Copyright (c) 2018 by Mattias Gaertner
  4. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. **********************************************************************}
  10. unit NodeJSFS;
  11. {$mode objfpc}
  12. {$ModeSwitch externalclass}
  13. interface
  14. uses
  15. JS, SysUtils;
  16. var
  17. DirectorySeparator: char = '/';
  18. DriveSeparator: string = '';
  19. ExtensionSeparator: char = '.';
  20. PathSeparator: char = ':';
  21. AllowDirectorySeparators: set of char = ['\','/'];
  22. AllowDriveSeparators: set of char = [];
  23. AllFilesMask: string = '*';
  24. //MaxPathLen: integer = 4096;
  25. PathDelim: char = '/'; // = DirectorySeparator;
  26. DriveDelim: string = ''; // = DriveSeparator;
  27. PathSep: char = ':'; // = PathSeparator;
  28. //MAX_PATH: integer = 4096; // = MaxPathLen;
  29. const
  30. //faReadOnly = 1;
  31. //faHidden = 2;
  32. //faSystem = 4;
  33. //faReserve = 8;
  34. faDirectory = 16;
  35. //faArchive = 32;
  36. function FileExists(Filename: string): boolean;
  37. function DirectoryExists(Filename: string): boolean;
  38. function ExtractFilePath(Filename: string): string;
  39. function ExtractFileName(Filename: string): string;
  40. function ExtractFileExt(Filename: string): string;
  41. function SetDirSeparators(Filename: string): string;
  42. function ExpandFileName(Filename: string): string;
  43. function IncludeTrailingPathDelimiter(Filename: string): string;
  44. function ChangeFileExt(Filename, NewExt: string): string;
  45. implementation
  46. function FileExists(Filename: string): boolean;
  47. begin
  48. writeln('FileExists TODO ',Filename);
  49. Result:=false; // ToDo
  50. if Filename='' then ;
  51. raise Exception.Create('FileExists TODO');
  52. end;
  53. function DirectoryExists(Filename: string): boolean;
  54. begin
  55. writeln('DirectoryExists TODO ',Filename);
  56. Result:=false; // ToDo
  57. if Filename='' then ;
  58. raise Exception.Create('DirectoryExists TODO');
  59. end;
  60. function ExtractFilePath(Filename: string): string;
  61. begin
  62. writeln('ExtractFilePath TODO ',Filename);
  63. Result:=''; // ToDo
  64. if Filename='' then ;
  65. raise Exception.Create('ExtractFilePath TODO');
  66. end;
  67. function ExtractFileName(Filename: string): string;
  68. begin
  69. writeln('ExtractFileName TODO ',Filename);
  70. Result:=''; // ToDo
  71. if Filename='' then ;
  72. raise Exception.Create('ExtractFileName TODO');
  73. end;
  74. function ExtractFileExt(Filename: string): string;
  75. begin
  76. writeln('ExtractFileExt TODO ',Filename);
  77. Result:=''; // ToDo
  78. if Filename='' then ;
  79. raise Exception.Create('ExtractFileExt TODO');
  80. end;
  81. function SetDirSeparators(Filename: string): string;
  82. begin
  83. writeln('SetDirSeparators TODO ',Filename);
  84. Result:=''; // ToDo
  85. if Filename='' then ;
  86. raise Exception.Create('SetDirSeparators TODO');
  87. end;
  88. function ExpandFileName(Filename: string): string;
  89. begin
  90. writeln('ExpandFileName TODO ',Filename);
  91. Result:=''; // ToDo
  92. if Filename='' then ;
  93. raise Exception.Create('ExpandFileName TODO');
  94. end;
  95. function IncludeTrailingPathDelimiter(Filename: string): string;
  96. begin
  97. writeln('IncludeTrailingPathDelimiter TODO ',Filename);
  98. Result:=''; // ToDo
  99. if Filename='' then ;
  100. raise Exception.Create('IncludeTrailingPathDelimiter TODO');
  101. end;
  102. function ChangeFileExt(Filename, NewExt: string): string;
  103. begin
  104. writeln('ChangeFileExt TODO ',Filename,' NewExt=',NewExt);
  105. Result:=''; // ToDo
  106. if Filename='' then ;
  107. if NewExt='' then ;
  108. raise Exception.Create('ChangeFileExt TODO');
  109. end;
  110. end.