Explorar o código

give more explicit error when file larger than Sys.max_string_length

Nicolas Cannasse %!s(int64=12) %!d(string=hai) anos
pai
achega
ab097ba03e
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      genswf.ml

+ 1 - 1
genswf.ml

@@ -834,7 +834,7 @@ let build_swf9 com file swc =
 		if String.length file > 5 && String.sub file 0 5 = "data:" then
 			String.sub file 5 (String.length file - 5)
 		else
-			(try Std.input_file ~bin:true file with _  -> error "File not found" p)
+			(try Std.input_file ~bin:true file with Invalid_argument("String.create") -> error "File is too big (max 16MB allowed)" p | _  -> error "File not found" p)
 	in
 	let bmp = List.fold_left (fun acc t ->
 		match t with