-
Notifications
You must be signed in to change notification settings - Fork 3
/
MakeHaxelib.hx
48 lines (41 loc) · 1.21 KB
/
MakeHaxelib.hx
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
import sys.FileSystem;
import sys.io.File;
class MakeHaxelib
{
public static function main()
{
var repos = [ "sdl", "png", "jpeg", "zlib", "ogg", "vorbis", "curl", "freetype", "modplug", "sdl-mixer", "angle" ];
Sys.command("rm",["-rf", "nme-toolkit"]);
Sys.command("mkdir",["nme-toolkit"]);
for(repo in repos)
{
Sys.println('$repo...');
FileSystem.createDirectory('nme-toolkit/$repo');
copy(repo, 'nme-toolkit/$repo');
}
var bytes = File.getBytes("haxelib.json");
File.saveBytes("nme-toolkit/haxelib.json",bytes);
var bytes = File.getBytes("README.md");
File.saveBytes("nme-toolkit/README.md",bytes);
}
static function copy(srcDir:String, destDir:String)
{
for(file in sys.FileSystem.readDirectory(srcDir))
{
if (file.substr(0,1)==".")
continue;
var src = srcDir + "/" + file;
var dest = destDir + "/" + file;
if (FileSystem.isDirectory(src))
{
FileSystem.createDirectory(dest);
copy(src,dest);
}
else
{
var bytes = File.getBytes(src);
File.saveBytes(dest,bytes);
}
}
}
}