diff --git a/tools/RunScript.hx b/tools/RunScript.hx index 2f7f54b253..76453084e0 100644 --- a/tools/RunScript.hx +++ b/tools/RunScript.hx @@ -31,8 +31,19 @@ class RunScript { public static function main () { var args = Sys.args (); + var cacheDirectory = Sys.getCwd (); var workingDirectory = args.pop (); + try { + + Sys.setCwd (workingDirectory); + + } catch (e:Dynamic) { + + LogHelper.error ("Cannot set current working directory to \"" + workingDirectory + "\""); + + } + if (args.length > 1 && args[0] == "create") { //args[1] = "openfl:" + args[1]; @@ -49,6 +60,8 @@ class RunScript { } else if (args.length > 0 && args[0] == "process") { + Sys.setCwd (cacheDirectory); + if (!FileSystem.exists ("tools/tools.n")) { rebuildTools (); @@ -61,17 +74,6 @@ class RunScript { } var args = [ "run", "lime" ].concat (args); - - try { - - Sys.setCwd (workingDirectory); - - } catch (e:Dynamic) { - - LogHelper.error ("Cannot set current working directory to \"" + workingDirectory + "\""); - - } - Sys.exit (Sys.command ("haxelib", args.concat ([ "-openfl" ]))); }