(* The body does not exist ==> we consider it an axiom *)
None
in
- CicUniv.directly_to_env_begin ();
- let obj = CicParser.obj_of_xml filename bodyfilename in
- CicUniv.directly_to_env_end ();
+ let cleanup () =
if cleanup_tmp then
begin
- Unix.unlink filename ;
+ if Sys.file_exists filename then Unix.unlink filename ;
match bodyfilename with
- Some f -> Unix.unlink f
+ Some f -> if Sys.file_exists f then Unix.unlink f
| None -> ()
end ;
+ in
+ CicUniv.directly_to_env_begin ();
+ let obj =
+ try
+ CicParser.obj_of_xml filename bodyfilename
+ with exn ->
+ cleanup ();
+ raise exn
+ in
+ CicUniv.directly_to_env_end ();
+ cleanup ();
obj
)
;;