Improve finding of NDLL folder in tools

This commit is contained in:
Joshua Granick
2018-07-07 06:49:12 -07:00
parent 673d1cf014
commit b9b3121c29
2 changed files with 26 additions and 52 deletions

View File

@@ -512,68 +512,39 @@ class CommandLineTools {
if (FileSystem.exists ("tools.n")) { if (FileSystem.exists ("tools.n")) {
path = PathHelper.combine (Sys.getCwd (), "../"); path = PathHelper.combine (Sys.getCwd (), "../ndll/");
} else if (FileSystem.exists ("run.n")) { } else if (FileSystem.exists ("run.n")) {
path = Sys.getCwd (); path = Sys.getCwd () + "/ndll/";
} }
if (path == "") { if (path == "") {
var process = new Process ("haxelib", [ "path", "lime" ]); var process = new Process ("haxelib", [ "path", "lime" ]);
var lines = new Array<String> ();
try { try {
while (true) { while (true) {
var length = lines.length;
var line = StringTools.trim (process.stdout.readLine ()); var line = StringTools.trim (process.stdout.readLine ());
trace (line);
if (StringTools.startsWith (line, "-L ")) {
if (length > 0 && (line == "-D lime" || StringTools.startsWith (line, "-D lime="))) { path = StringTools.trim (line.substr (2));
break;
path = StringTools.trim (lines[length - 1]);
}
lines.push (line);
}
} catch (e:Dynamic) {
}
if (path == "") {
for (line in lines) {
if (line != "" && line.substr (0, 1) != "-") {
try {
if (FileSystem.exists (line)) {
path = line;
}
} catch (e:Dynamic) {}
} }
} }
} } catch (e:Dynamic) {}
process.close (); process.close ();
} }
path += "../ndll/";
switch (PlatformHelper.hostPlatform) { switch (PlatformHelper.hostPlatform) {
case WINDOWS: case WINDOWS:

View File

@@ -26,36 +26,39 @@ class SVGExport {
var haxePath = Sys.getEnv ("HAXEPATH"); var haxePath = Sys.getEnv ("HAXEPATH");
var command = (haxePath != null && haxePath != "") ? haxePath + "/haxelib" : "haxelib"; var command = (haxePath != null && haxePath != "") ? haxePath + "/haxelib" : "haxelib";
var process = new Process (command, [ "path", "lime" ]);
var path = ""; var path = "";
try { if (FileSystem.exists ("svg.n")) {
var lines = new Array<String> (); path = PathHelper.combine (Sys.getCwd (), "../ndll/");
while (true) { }
var length = lines.length; if (path == "") {
var line = StringTools.trim (process.stdout.readLine ());
if (length > 0 && (line == "-D lime" || StringTools.startsWith (line, "-D lime="))) { var process = new Process ("haxelib", [ "path", "lime" ]);
path = StringTools.trim (lines[length - 1]); try {
while (true) {
var line = StringTools.trim (process.stdout.readLine ());
trace (line);
if (StringTools.startsWith (line, "-L ")) {
path = StringTools.trim (line.substr (2));
break;
}
} }
lines.push (line); } catch (e:Dynamic) {}
}
} catch (e:Dynamic) {
process.close (); process.close ();
} }
path += "../ndll/";
switch (PlatformHelper.hostPlatform) { switch (PlatformHelper.hostPlatform) {
case WINDOWS: case WINDOWS: