Skip to content

Commit

Permalink
Merge pull request #1873 from player-03/RunScript_absolute_paths
Browse files Browse the repository at this point in the history
Use absolute paths when running Lime.
  • Loading branch information
player-03 authored Dec 11, 2024
2 parents c81ad95 + 8a1083b commit 0b08e7f
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions tools/RunScript.hx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,8 @@ import sys.FileSystem;

class RunScript
{
private static function rebuildTools(rebuildBinaries = true):Void
private static function rebuildTools(limeDirectory:String, toolsDirectory:String, rebuildBinaries = true):Void
{
var limeDirectory = Haxelib.getPath(new Haxelib("lime"), true);
var toolsDirectory = Path.combine(limeDirectory, "tools");

if (!FileSystem.exists(toolsDirectory))
{
toolsDirectory = Path.combine(limeDirectory, "../tools");
}

/*var extendedToolsDirectory = Haxelib.getPath (new Haxelib ("lime-extended"), false);
if (extendedToolsDirectory != null && extendedToolsDirectory != "") {
Expand Down Expand Up @@ -135,6 +127,15 @@ class RunScript
{
var args = Sys.args();

var limeDirectory = Haxelib.getPath(new Haxelib("lime"), true);
var toolsDirectory = Path.combine(limeDirectory, "tools");

if (!FileSystem.exists(toolsDirectory))
{
limeDirectory = Path.combine(limeDirectory, "..");
toolsDirectory = Path.combine(limeDirectory, "tools");
}

if (args.length > 2 && args[0] == "rebuild" && args[1] == "tools")
{
var lastArgument = new Path(args[args.length - 1]).toString();
Expand Down Expand Up @@ -187,7 +188,7 @@ class RunScript
}
}

rebuildTools(rebuildBinaries);
rebuildTools(limeDirectory, toolsDirectory, rebuildBinaries);

if (args.indexOf("-openfl") > -1)
{
Expand All @@ -207,21 +208,22 @@ class RunScript

var args = [
"-D", "lime",
"-cp", "tools",
"-cp", "tools/platforms",
"-cp", toolsDirectory,
"-cp", Path.combine(toolsDirectory, "platforms"),
"-cp", "src",
"-lib", "format",
"-lib", "hxp",
"--run", "CommandLineTools"].concat(args);
Sys.exit(runCommand("", "haxe", args));
}

if (!FileSystem.exists("tools/tools.n") || args.indexOf("-rebuild") > -1)
var tools_n = Path.combine(toolsDirectory, "tools.n");
if (!FileSystem.exists(tools_n) || args.indexOf("-rebuild") > -1)
{
rebuildTools();
rebuildTools(limeDirectory, toolsDirectory);
}

var args = ["tools/tools.n"].concat(args);
var args = [tools_n].concat(args);
Sys.exit(runCommand("", "neko", args));
}
}

0 comments on commit 0b08e7f

Please sign in to comment.