1 (* vim: set sw=8 ts=8 et: *)
4 let mapjoin f l = (List.fold_left (fun a b -> a ^ (f b)) "" l)
7 let mapjoine e f = function
9 | h::t -> (List.fold_left (fun a b -> a ^ e ^ (f b)) (f h) t)
11 (* Exception used by open_out_unless_exists below *)
12 exception FileAlreadyExists
14 (* Wrapper which raise an exception when output path already exist *)
15 let open_out_unless_exists path =
16 if Sys.file_exists path
17 then raise FileAlreadyExists
21 let run_in_other_directory tmppath cmd =
22 let prevdir = Sys.getcwd () in(
24 let retval = Sys.command cmd in
25 (Sys.chdir prevdir; retval)