(Unix.stat fname).Unix.st_kind = Unix.S_REG
with Unix.Unix_error _ -> false
+let is_executable fname =
+ try
+ let stat = (Unix.stat fname) in
+ stat.Unix.st_kind = Unix.S_REG &&
+ (stat.Unix.st_perm land 0o001 > 0)
+ with Unix.Unix_error _ -> false
+
let mkdir path =
let components = split ~sep:'/' path in
let rec aux where = function
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 is_executable: string -> bool (** @return true if file is executable *)
val mkdir: string -> unit (** create dir and parents. @raise Failure *)
val tilde_expand: string -> string (** bash-like (head) tilde expansion *)
val safe_remove: string -> unit (** removes a file if it exists *)