浏览代码

fixed errors when accessing std package with haxe the classpath (close #2193)

Nicolas Cannasse 12 年之前
父节点
当前提交
3682ed0278
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      typeload.ml

+ 6 - 0
typeload.ml

@@ -2385,6 +2385,12 @@ let resolve_module_file com m remap p =
 		if (try (Unix.stat file).Unix.st_size with _ -> 0) > 0 then file else raise Not_found
 		if (try (Unix.stat file).Unix.st_size with _ -> 0) > 0 then file else raise Not_found
 	| _ -> file
 	| _ -> file
 	) in
 	) in
+	(* if we try to load a std.xxxx class and resolve a real std file, the package name is not valid, ignore *)
+	(match fst m with
+	| "std" :: _ ->
+		let file = Common.unique_full_path file in
+		if List.exists (fun path -> ExtString.String.starts_with file (try Common.unique_full_path path with _ -> path)) com.std_path then raise Not_found;
+	| _ -> ());
 	if !forbid then begin
 	if !forbid then begin
 		let _, decls = (!parse_hook) com file p in
 		let _, decls = (!parse_hook) com file p in
 		let meta = (match decls with
 		let meta = (match decls with