From 742332c845b599fbdaa86a02e21a5f223a4783f9 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Fri, 3 Feb 2006 15:14:27 +0000 Subject: [PATCH] bugfix: mkdir now works also for realtive directories --- helm/ocaml/extlib/hExtlib.ml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/helm/ocaml/extlib/hExtlib.ml b/helm/ocaml/extlib/hExtlib.ml index 15a459cdc..5f96e0f84 100644 --- a/helm/ocaml/extlib/hExtlib.ml +++ b/helm/ocaml/extlib/hExtlib.ml @@ -27,15 +27,14 @@ (** PROFILING *) -(* we should use a key in te registry, but we can't see the registry.. *) -let profiling_enabled = true +let profiling_enabled = ComponentsConf.profiling let profiling_printings = ref (fun () -> true) let set_profiling_printings f = profiling_printings := f type profiler = { profile : 'a 'b. ('a -> 'b) -> 'a -> 'b } let profile ?(enable = true) = - if profiling_enabled && enable then + if profiling_enabled && enable then function s -> let total = ref 0.0 in let profile f x = @@ -163,7 +162,8 @@ let mkdir path = let rec aux where = function | [] -> () | piece::tl -> - let path = where ^ "/" ^ piece in + let path = + if where = "" then piece else where ^ "/" ^ piece in (try Unix.mkdir path 0o755 with @@ -174,7 +174,8 @@ let mkdir path = ("Unix.mkdir " ^ path ^ " 0o755 :" ^ (Unix.error_message e)))); aux path tl in - aux "" components + let where = if path.[0] = '/' then "/" else "" in + aux where components (** {2 Filesystem} *) -- 2.39.2