]> matita.cs.unibo.it Git - helm.git/blobdiff - components/extlib/hExtlib.ml
added an utility function
[helm.git] / components / extlib / hExtlib.ml
index 07886f2690e8eaba64137d434f330793c2423e04..d9b24c2eb38d92bd4377bbafcf08d4ab6322700c 100644 (file)
@@ -229,6 +229,13 @@ let is_regular fname =
     (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