aboutsummaryrefslogtreecommitdiff
path: root/types/lfs.d.tl
blob: 12535ca47a44465255c18af83106db673c93adea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
local record lfs

   enum FileMode
      "file"
      "directory"
      "link"
      "socket"
      "named pipe"
      "char device"
      "block device"
      "other"
   end

   record Attributes
      dev: number
      ino: number
      mode: FileMode
      nlink: number
      uid: number
      gid: number
      rdev: number
      access: number
      modification: number
      change: number
      size: number
      permissions: string
      blocks: number
      blksize: number
   end

   enum OpenFileMode
      "binary"
      "text"
   end

   enum LockMode
      "r"
      "w"
   end

   record Lock
      free: function()
   end

   dir: function(string): function(): string

   chdir: function(string): boolean, string

   lock_dir: function(string, number): Lock, string

   -- returns number on success, really!? this should be fixed in the lfs library
   link: function(string, string, boolean): number, string

   mkdir: function(string): boolean, string

   rmdir: function(string): boolean, string

   setmode: function(string, OpenFileMode): boolean, string

   currentdir: function(): string

   attributes: function(string): Attributes
   attributes: function(string, string): string
   attributes: function(string, string): number
   attributes: function(string, string): FileMode
   attributes: function(string, Attributes): Attributes

   symlinkattributes: function(string): Attributes
   symlinkattributes: function(string, string): string
   symlinkattributes: function(string, string): number
   symlinkattributes: function(string, string): FileMode
   symlinkattributes: function(string, Attributes): Attributes

   touch: function(string, number, number): boolean, string

   -- TODO: FILE needs to be renamed to io.FILE in tl itself
   lock: function(FILE, LockMode, number, number): boolean, string
   unlock: function(FILE, number, number): boolean, string

end

return lfs