let path =
if where = "" then piece else where ^ "/" ^ piece in
(try
- Unix.mkdir path 0o755
+ Unix.mkdir path 0o775
with
| Unix.Unix_error (Unix.EEXIST,_,_) -> ()
| Unix.Unix_error (e,_,_) ->
raise
(Failure
- ("Unix.mkdir " ^ path ^ " 0o755 :" ^ (Unix.error_message e))));
+ ("Unix.mkdir " ^ path ^ " 0o775 :" ^ (Unix.error_message e))));
aux path tl
in
let where = if path.[0] = '/' then "/" else "" in
aux where components
+let chmod mode filename =
+ Unix.chmod filename mode
+
(** {2 Filesystem} *)
let input_file fname =
let output_file ~filename ~text =
let oc = open_out filename in
output_string oc text;
- close_out oc
+ close_out oc;
+ chmod 0o664 filename
let blank_split s =
let len = String.length s in
val safe_rmdir: string -> unit (** removes a dir if it exists and is empty *)
val is_dir_empty: string -> bool (** checks if the dir is empty *)
val rmdir_descend: string -> unit (** rmdir -p *)
+val chmod: int -> string -> unit (** chmod *)
(** find all _files_ whose name matches test under a filesystem root.
* Test is passed the filename path relative to the given filesystem root *)
output_string oc (string_of_int version); (* field 4 *)
output_binary_int oc (Hashtbl.hash marshalled); (* field 5 *)
output_string oc marshalled; (* field 6 *)
- close_out oc
+ close_out oc;
+ HExtlib.chmod 0o664 fname
let expect ic fname s =
let len = String.length s in
match fn with
| Some filename ->
let outchan = Gzip.open_out filename in
- (try
+ begin try
pp_to_gzipchan strm outchan;
with e ->
Gzip.close_out outchan;
- raise e);
- Gzip.close_out outchan
+ raise e
+ end;
+ Gzip.close_out outchan;
+ HExtlib.chmod 0o664 filename;
| None -> failwith "Can't sent gzipped output to stdout"
else
match fn with
| Some filename ->
let outchan = open_out filename in
- (try
+ begin try
pp_to_outchan strm outchan;
with e ->
close_out outchan;
- raise e);
- close_out outchan
+ raise e
+ end;
+ close_out outchan;
+ HExtlib.chmod 0o664 filename
| None -> pp_to_outchan strm stdout
;;