64 |
begin try |
begin try |
65 |
let dir = opendir dir in () |
let dir = opendir dir in () |
66 |
with |
with |
67 |
Unix.Unix_error (EACCES, _, _) -> failwith (Printf.sprintf "access denied for directory %s" dir) |
Unix.Unix_error (EACCES, _, _) -> lprintf "access denied for directory %s" dir; exit 73 |
68 |
| Unix.Unix_error (ENOENT, _, _) -> failwith (Printf.sprintf "directory %s not found, orphaned link?" dir) |
| Unix.Unix_error (ENOENT, _, _) -> lprintf "directory %s not found, orphaned link?" dir; exit 73 |
69 |
| e -> failwith (Printf.sprintf "error %s for directory %s" (Printexc2.to_string e) dir) |
| e -> lprintf "error %s for directory %s" (Printexc2.to_string e) dir; exit 73 |
70 |
end |
end |
71 |
else begin |
else begin |
72 |
let predir = Filename.dirname dir in |
let predir = Filename.dirname dir in |
157 |
(try Sys.remove temp_file with _ -> ()) |
(try Sys.remove temp_file with _ -> ()) |
158 |
with |
with |
159 |
Sys_error s when s = temp_file ^ ": " ^ (Unix.error_message Unix.EACCES) -> |
Sys_error s when s = temp_file ^ ": " ^ (Unix.error_message Unix.EACCES) -> |
160 |
failwith (Printf.sprintf "can not create files in directory %s, check rights..." dirname) |
lprintf "can not create files in directory %s, check rights..." dirname; exit 73 |
161 |
| Sys_error s -> failwith (Printf.sprintf "%s for directory %s" s dirname) |
| Sys_error s -> lprintf "%s for directory %s" s dirname; exit 73 |
162 |
| e -> failwith (Printf.sprintf "%s for directory %s" (Printexc2.to_string e) dirname) |
| e -> lprintf "%s for directory %s" (Printexc2.to_string e) dirname; exit 73 |