Fix 'haxelib path lib:version' if version is equal to set, and multiple installs have the same version (like 1,0,0 and git and hg)

This commit is contained in:
Joshua Granick
2017-05-22 13:33:28 -07:00
parent 8d4b5151b5
commit 9393cfc681

View File

@@ -1079,6 +1079,10 @@ class Main {
return dev;
}
}
var current = try getCurrent(dir) catch(e:Dynamic) null;
if ( current != null && matchVersion(version, current) ) {
return dir+"/"+Data.safe(current);
}
var matches = [];
for( v in FileSystem.readDirectory(dir) ) {
if( v == version ) return dir+"/"+v;
@@ -1098,7 +1102,7 @@ class Main {
}
var best:Dynamic = null;
for( match in matches ) {
if (best == null || match.ver > best.ver) {
if (best == null || match.ver > best.ver || (match.ver == best.ver && match.dir.indexOf (",") == -1)) {
best = match;
}
}