X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=src%2Futils.ml;h=d1b0efac4e56e1e0e7e52b57d7e7424d3c8f10c8;hb=50da8152f0cfceeea7c92d55c8bc2f75cecd98ef;hp=235167d3538c3b301d70ce2aa7b7bdf391448c50;hpb=8d04b4bd26597721c1463f6ab96b705a6caae53b;p=goals.git diff --git a/src/utils.ml b/src/utils.ml index 235167d..d1b0efa 100644 --- a/src/utils.ml +++ b/src/utils.ml @@ -21,6 +21,9 @@ open Printf let failwithf fs = ksprintf failwith fs +let (//) = Filename.concat +let is_directory d = try Sys.is_directory d with Sys_error _ -> false + (* From OCaml 4.08 sources. We can remove this when we can * depend on min OCaml 4.08. *) @@ -79,3 +82,6 @@ let trimr ?(test = isspace) str = let trim ?(test = isspace) str = trimr ~test (triml ~test str) + +let absolute_path path = + if not (Filename.is_relative path) then path else Sys.getcwd () // path