]> matita.cs.unibo.it Git - helm.git/blobdiff - components/extlib/hExtlib.ml
modifications to make matita behave reasonably, removed some useless windows
[helm.git] / components / extlib / hExtlib.ml
index 2fba7f651497a532af8db1445cdc12d25dcea302..c32ed0bed9b5d6daac98063553aa56e50445de70 100644 (file)
@@ -438,7 +438,7 @@ let normalize_path s =
 
 let find_in paths path =
    let rec aux = function
-   | [] -> raise (Failure "not found")
+   | [] -> raise (Failure "find_in")
    | p :: tl ->
       let path = normalize_path (p ^ "/" ^ path) in
        try
@@ -450,7 +450,19 @@ let find_in paths path =
      aux paths
    with Unix.Unix_error _ | Failure _ -> 
      raise 
-       (Failure ("File " ^ path ^ " not found (or not readable) in: " ^
-         String.concat ":" paths))
+       (Failure "find_in")
 ;;
        
+let is_prefix_of d1 d2 =
+    let len1 = String.length d1 in
+    let len2 = String.length d2 in
+    if len2 < len1 then 
+      false
+    else
+      let pref = String.sub d2 0 len1 in
+      pref = d1 && (len1 = len2 || d2.[len1] = '/')
+;;
+
+let touch s =
+  try close_out(open_out s) with Sys_error _ -> ()
+;;