Replace __findHaxelib() with a function that finds Lime's NDLL folder.
This is its only use case, so there's no need for an intermediate step of getting the library root. `haxelib path` does return the NDLL folder; the problem with the old implementation of `__findHaxelib()` was it got Lime's source folder instead.
This commit is contained in:
@@ -155,15 +155,15 @@ class CFFI
|
|||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
var haxelib = __findHaxelib("lime");
|
var ndllFolder = __findNDLLFolder();
|
||||||
|
|
||||||
if (haxelib != "")
|
if (ndllFolder != "")
|
||||||
{
|
{
|
||||||
result = __tryLoad(haxelib + "/ndll/" + __sysName() + "/" + library, library, method, args);
|
result = __tryLoad(ndllFolder + __sysName() + "/" + library, library, method, args);
|
||||||
|
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
result = __tryLoad(haxelib + "/ndll/" + __sysName() + "64/" + library, library, method, args);
|
result = __tryLoad(ndllFolder + __sysName() + "64/" + library, library, method, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -204,32 +204,30 @@ class CFFI
|
|||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function __findHaxelib(library:String):String
|
private static function __findNDLLFolder():String
|
||||||
{
|
{
|
||||||
#if (sys && !macro && !html5)
|
#if (sys && !macro && !html5)
|
||||||
var proc:Process = null;
|
var process = new Process("haxelib", ["path", "lime"]);
|
||||||
try
|
|
||||||
{
|
|
||||||
proc = new Process("haxelib", ["libpath", library]);
|
|
||||||
} catch (e:Dynamic) {}
|
|
||||||
if (proc == null) return "";
|
|
||||||
|
|
||||||
var stream = proc.stdout;
|
|
||||||
var path:String = "";
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
path = stream.readLine();
|
while (true)
|
||||||
__loaderTrace("Found haxelib " + path);
|
{
|
||||||
} catch (e:Dynamic) {}
|
var line = StringTools.trim(process.stdout.readLine());
|
||||||
|
|
||||||
stream.close();
|
if (StringTools.startsWith(line, "-L "))
|
||||||
proc.close();
|
{
|
||||||
|
process.close();
|
||||||
|
return Path.addTrailingSlash(line.substr(3));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (e:Dynamic) {}
|
||||||
|
|
||||||
return path;
|
process.close();
|
||||||
#else
|
|
||||||
return "";
|
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function __loaderTrace(message:String)
|
private static function __loaderTrace(message:String)
|
||||||
@@ -298,7 +296,7 @@ class CFFI
|
|||||||
}
|
}
|
||||||
else if (!lazy)
|
else if (!lazy)
|
||||||
{
|
{
|
||||||
var ndllFolder = __findHaxelib("lime") + "/ndll/" + __sysName();
|
var ndllFolder = __findNDLLFolder() + __sysName();
|
||||||
throw "Could not find lime.ndll. This file is provided with Lime's Haxelib releases, but not via Git. "
|
throw "Could not find lime.ndll. This file is provided with Lime's Haxelib releases, but not via Git. "
|
||||||
+ "Please copy it from Lime's latest Haxelib release into either "
|
+ "Please copy it from Lime's latest Haxelib release into either "
|
||||||
+ ndllFolder + " or " + ndllFolder + "64, as appropriate for your system. "
|
+ ndllFolder + " or " + ndllFolder + "64, as appropriate for your system. "
|
||||||
|
|||||||
Reference in New Issue
Block a user