From 9393cfc681d1a6099428b416d371878a4dc8c4da Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Mon, 22 May 2017 13:33:28 -0700 Subject: [PATCH] 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) --- tools/haxelib/client/Main.hx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/haxelib/client/Main.hx b/tools/haxelib/client/Main.hx index 4d3a43680..3ad0707ad 100644 --- a/tools/haxelib/client/Main.hx +++ b/tools/haxelib/client/Main.hx @@ -1079,9 +1079,13 @@ 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; + if( v == version ) return dir+"/"+v; if( v.charAt(0) == "." ) continue; v = Data.unsafe(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; } }