Ver Fonte

Remove haxelib resolution code from genneko

Since Haxelib 3.3.0, -L always comes with an absolute path, so this was
useless anyway
tobil4sk há 2 anos atrás
pai
commit
ddd0754228
1 ficheiros alterados com 5 adições e 33 exclusões
  1. 5 33
      src/generators/genneko.ml

+ 5 - 33
src/generators/genneko.ml

@@ -662,19 +662,6 @@ let generate_libs_init = function
 	| libs ->
 		(*
 			var @s = $loader.loadprim("std@sys_string",0)();
-			var @env = $loader.loadprim("std@get_env",1);
-			var @b = if( @s == "Windows" )
-				@env("HAXEPATH") + "\\lib\\"
-				else try $loader.loadprim("std@file_contents",1)(@env("HOME")+"/.haxelib") + "/"
-				catch e
-					if( @s == "Linux" )
-						if( $loader(loadprim("std@sys_exists",1))("/usr/lib/haxe/lib") )
-							"/usr/lib/haxe/lib"
-						else
-							"/usr/share/haxe/lib/"
-					else
-						"/usr/local/lib/haxe/lib/";
-			if( try $loader.loadprim("std@sys_file_type",1)(".haxelib") == "dir" catch e false ) @b = $loader.loadprim("std@file_full_path",1)(".haxelib") + "/";
 			if( $version() >= 240 )
 				@s = @s + switch $loader.loadprim("std@sys_cpu_arch",0)() {
 					"arm64" => "Arm64"
@@ -682,8 +669,9 @@ let generate_libs_init = function
 					"x86_64" => "64"
 					default => ""
 				};
-			else if( $loader.loadprim("std@sys_is64",0)() ) @s = @s + 64;
-			@b = @b + "/"
+			else if( $loader.loadprim("std@sys_is64",0)() )
+				@s = @s + 64;
+			@s = @s + "/";
 		*)
 		let p = null_pos in
 		let es = ident p "@s" in
@@ -696,22 +684,7 @@ let generate_libs_init = function
 		let boot = [
 			(EVars [
 				"@s",Some (call p (loadp "sys_string" 0) []);
-				"@env",Some (loadp "get_env" 1);
-				"@b", Some (EIf (op "==" es (str p "Windows"),
-					op "+" (call p (ident p "@env") [str p "HAXEPATH"]) (str p "\\lib\\"),
-					Some (ETry (
-						op "+" (call p (loadp "file_contents" 1) [op "+" (call p (ident p "@env") [str p "HOME"]) (str p "/.haxelib")]) (str p "/"),
-						"e",
-						(EIf (op "==" es (str p "Linux"),
-							(EIf (call p (loadp "sys_exists" 1) [ str p "/usr/lib/haxe/lib" ],
-								str p "/usr/lib/haxe/lib/",
-								Some (str p "/usr/share/haxe/lib/")),p),
-							Some (str p "/usr/local/lib/haxe/lib/")
-						),p)
-					),p)
-				),p);
 			],p);
-			(EIf ((ETry (op "==" (call p (loadp "sys_file_type" 1) [str p ".haxelib"]) (str p "dir"),"e",(EConst False,p)),p),op "=" (ident p "@b") (op "+" (call p (loadp "file_full_path" 1) [str p ".haxelib"]) (str p "/")), None),p);
 			(EIf (op ">=" (builtin p "version") (int p 240),
 				(op "=" es (op "+" es (ESwitch (call p (loadp "sys_cpu_arch" 0) [],[
 					(str p "arm64", str p "Arm64");
@@ -724,13 +697,12 @@ let generate_libs_init = function
 		] in
 		let lpath = field p (builtin p "loader") "path" in
 		boot @ List.map (fun dir ->
-			let full_path = dir.[0] = '/' || dir.[1] = ':' in
 			let dstr = str p dir in
 			(*
 				// for each lib dir
-				$loader.path = $array($loader.path,@b+dir+@s);
+				$loader.path = $array(dir+@s,$loader.path);
 			*)
-			op "=" lpath (call p (builtin p "array") [op "+" (if full_path then dstr else op "+" (ident p "@b") dstr) (ident p "@s"); lpath])
+			op "=" lpath (call p (builtin p "array") [op "+" dstr (ident p "@s"); lpath])
 		) libs
 
 let new_context com ver macros =