-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFileSystem.hx
More file actions
59 lines (50 loc) · 1.26 KB
/
FileSystem.hx
File metadata and controls
59 lines (50 loc) · 1.26 KB
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
package python;
import python.lib.Os;
import python.lib.os.Path;
class FileSystem {
public static function exists( path : String ) : Bool {
return Path.exists(path);
}
public static function stat( path : String ) : sys.FileStat {
var s = Os.stat(path);
return {
gid : s.st_gid,
uid : s.st_uid,
atime : Date.fromTime(s.st_atime),
mtime : Date.fromTime(s.st_mtime),
ctime : Date.fromTime(s.st_ctime),
size : s.st_size,
dev : s.st_dev,
ino : s.st_ino,
nlink : s.st_nlink,
rdev : s.st_rdev,
mode : s.st_mode
}
}
public static function rename( path : String, newPath : String ) : Void {
Os.rename(path, newPath);
}
public static function fullPath( relPath : String ) : String {
return Path.abspath(relPath);
}
public static function isDirectory( path : String ) : Bool
{
return Path.isdir(path);
}
public static function createDirectory( path : String ) : Void
{
Os.mkdir(path);
}
public static function deleteFile( path : String ) : Void
{
Os.remove(path);
}
public static function deleteDirectory( path : String ) : Void
{
Os.rmdir(path);
}
public static function readDirectory( path : String ) : Array<String>
{
return Os.listdir(path);
}
}