Browse Source

trim -cp and -resource

Nicolas Cannasse 18 years ago
parent
commit
1bb21e0e56
1 changed files with 6 additions and 1 deletions
  1. 6 1
      main.ml

+ 6 - 1
main.ml

@@ -38,6 +38,7 @@ let get_full_path file =
 	Extc.get_full_path file
 	Extc.get_full_path file
 
 
 let normalize_path p =
 let normalize_path p =
+	let p = ExtString.String.strip p in
 	let l = String.length p in
 	let l = String.length p in
 	if l = 0 then
 	if l = 0 then
 		"./"
 		"./"
@@ -273,12 +274,16 @@ try
 			Plugin.define def;
 			Plugin.define def;
 		),"<var> : define a conditional compilation flag");
 		),"<var> : define a conditional compilation flag");
 		("-resource",Arg.String (fun res ->
 		("-resource",Arg.String (fun res ->
-			match ExtString.String.nsplit res "@" with
+			match ExtString.String.nsplit (ExtString.String.strip res) "@" with
 			| [file; name] ->
 			| [file; name] ->
 				let file = (try Plugin.find_file file with Not_found -> file) in
 				let file = (try Plugin.find_file file with Not_found -> file) in
 				let data = Std.input_file ~bin:true file in
 				let data = Std.input_file ~bin:true file in
 				if Hashtbl.mem hres name then failwith ("Duplicate resource name " ^ name);
 				if Hashtbl.mem hres name then failwith ("Duplicate resource name " ^ name);
 				Hashtbl.add hres name data
 				Hashtbl.add hres name data
+			| [file] ->
+				let file = (try Plugin.find_file file with Not_found -> file) in
+				let data = Std.input_file ~bin:true file in
+				Hashtbl.replace hres file data
 			| _ ->
 			| _ ->
 				raise (Arg.Bad "Invalid Resource format : should be file@name")
 				raise (Arg.Bad "Invalid Resource format : should be file@name")
 		),"<file@name> : add a named resource file");
 		),"<file@name> : add a named resource file");