diff --git a/run.n b/run.n index ae4568d2c..a2ddad55f 100644 Binary files a/run.n and b/run.n differ diff --git a/tools/CommandLineTools.hx b/tools/CommandLineTools.hx index 4bfe82910..860b2c2e6 100644 --- a/tools/CommandLineTools.hx +++ b/tools/CommandLineTools.hx @@ -433,6 +433,20 @@ class CommandLineTools { } + if (path == "") { + + if (FileSystem.exists ("tools.n")) { + + path = PathHelper.combine (Sys.getCwd (), "../"); + + } else if (FileSystem.exists ("run.n")) { + + path = Sys.getCwd (); + + } + + } + process.close (); path += "/ndll/"; @@ -520,15 +534,15 @@ class CommandLineTools { args = args.concat (additionalArguments); } - - if (exeExists) { - - ProcessHelper.runCommand ("", exePath, args); - - } else { + if (exeExists) { + + ProcessHelper.runCommand ("", exePath, args); + + } else { + ProcessHelper.runCommand ("", "haxelib", ["run", handler].concat (args)); - + } try { @@ -1412,12 +1426,13 @@ class CommandLineTools { private function processArguments ():Void { var arguments = Sys.args (); + var runFromHaxelib = false; if (arguments.length > 0) { // When the command-line tools are called from haxelib, // the last argument is the project directory and the - // path to NME is the current working directory + // path to Lime is the current working directory var lastArgument = ""; @@ -1439,6 +1454,25 @@ class CommandLineTools { if (FileSystem.exists (lastArgument) && FileSystem.isDirectory (lastArgument)) { Sys.setCwd (lastArgument); + runFromHaxelib = true; + + } else { + + arguments.push (lastArgument); + + } + + } + + if (!runFromHaxelib) { + + if (FileSystem.exists ("tools.n")) { + + PathHelper.haxelibOverrides.set ("lime", PathHelper.combine (Sys.getCwd (), "../")); + + } else if (FileSystem.exists ("run.n")) { + + PathHelper.haxelibOverrides.set ("lime", Sys.getCwd ()); } diff --git a/tools/RunScript.hx b/tools/RunScript.hx index 4e8ceea24..01ac425c0 100644 --- a/tools/RunScript.hx +++ b/tools/RunScript.hx @@ -160,11 +160,8 @@ class RunScript { public static function main () { var args = Sys.args (); - if (args.length == 0) return; - var command = args[0].toLowerCase (); - - if (args.length > 2 && command == "rebuild" && args[1] == "tools") { + if (args.length > 2 && args[0] == "rebuild" && args[1] == "tools") { var lastArgument = new Path (args[args.length - 1]).toString (); diff --git a/tools/svg.hxml b/tools/svg.hxml index 6120edb2d..baa37191b 100644 --- a/tools/svg.hxml +++ b/tools/svg.hxml @@ -1,6 +1,7 @@ -main SVGExport -neko ../svg.n --lib lime +-D lime +-cp .. -lib openfl -lib svg -D lime_cairo diff --git a/tools/tools.hxml b/tools/tools.hxml index 3242cbe27..06f6c4541 100644 --- a/tools/tools.hxml +++ b/tools/tools.hxml @@ -1,7 +1,8 @@ -main CommandLineTools -neko tools.n -D lime-curl --lib lime +-D lime +-cp .. -lib format #-lib svg -D optional_cffi \ No newline at end of file