(Unix.stat fname).Unix.st_kind = Unix.S_DIR
with Unix.Unix_error _ -> false
+let writable_dir path =
+ try
+ let file = path ^ "/prova_matita" in
+ let oc = open_out file in
+ close_out oc;
+ Sys.remove file;
+ true
+ with Sys_error _ -> false
+
+
let is_regular fname =
try
(Unix.stat fname).Unix.st_kind = Unix.S_REG
(** {2 Filesystem} *)
val is_dir: string -> bool (** @return true if file is a directory *)
+val writable_dir: string -> bool (** @return true if the directory is writable *)
val is_regular: string -> bool (** @return true if file is a regular file *)
val mkdir: string -> unit (** create dir and parents. @raise Failure *)
val tilde_expand: string -> string (** bash-like (head) tilde expansion *)