Lfs.hx 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (C)2005-2017 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. package lua.lib.lfs;
  23. @:luaRequire("lfs")
  24. extern class Lfs {
  25. @:overload( function (filepath : String, aname : String) : Dynamic {})
  26. public static function attributes(filepath : String) : LfsFileStat;
  27. public static function chdir(path : String) : LfsStatus<Bool>;
  28. public static function lock_dir(path : String, ?second_stale : Int) : LfsStatus<String>;
  29. public static function currentdir() : LfsStatus<String>;
  30. public static function dir(path : String) : Void->String;
  31. public static function lock(filename : String, mode : String, ?start : Int, ?length : Int) : LfsStatus<Bool>;
  32. public static function link(old : String, _new :String, ?symlink : Bool) : Void;
  33. public static function mkdir(dirname : String) : LfsStatus<Bool>;
  34. public static function rmdir(dirname : String) : LfsStatus<Bool>;
  35. public static function setmode(file: String, mode : String) : LfsStatus<Bool>;
  36. public static function symlinkattributes(filepath : String, ?aname : String) : Table<String, String>;
  37. public static function touch(filepath : String, ?atime : Int, ?mtime : Int) : LfsStatus<Bool>;
  38. public static function unlock(filehandle : String, ?start : Int, ?length : Int) : LfsStatus<Bool>;
  39. }
  40. @:multiReturn extern class LfsStatus<T> {
  41. var status : T;
  42. var message : String;
  43. }
  44. @:multiReturn extern class LfsDir {
  45. var iter : DirObj->String;
  46. var dirobj : DirObj;
  47. }
  48. typedef DirObj = {
  49. next : Void->String,
  50. close : Void->Void
  51. };