forked from FunkinDroidTeam/lime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommandHelper.hx
44 lines (39 loc) · 910 Bytes
/
CommandHelper.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
package lime.tools;
import hxp.*;
import lime.tools.CLICommand;
import lime.tools.Platform;
class CommandHelper
{
public static function executeCommands(commands:Array<CLICommand>):Void
{
for (c in commands)
{
Sys.command(c.command, c.args);
}
}
public static function openFile(file:String):CLICommand
{
if (System.hostPlatform == WINDOWS)
{
return new CLICommand("start", [file]);
}
else if (System.hostPlatform == MAC)
{
return new CLICommand("/usr/bin/open", [file]);
}
else
{
return new CLICommand("/usr/bin/xdg-open", [file]);
}
}
public static function interpretHaxe(mainFile:String):CLICommand
{
return new CLICommand("haxe", ["-main", mainFile, "--interp"]);
}
public static function fromSingleString(command:String):CLICommand
{
var args:Array<String> = command.split(" ");
command = args.shift();
return new CLICommand(command, args);
}
}