let chdir dir = try Sys.chdir dir with | e -> failwith (Printf.sprintf "Filew.chdir: can't chdir to %S: %s" dir (Printexc.to_string e))