Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[fix] file.ml: revert to previous check_create_path behavioour

see commit 97e53b1
  • Loading branch information...
commit f771f1f7ed7f09fc46da26e06cb2d098ae5f4f24 1 parent 7bcd8f6
Frederic Ye Aqua-Ye authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 ocamllib/libbase/file.ml
9 ocamllib/libbase/file.ml
View
@@ -1,5 +1,5 @@
(*
- Copyright © 2011 MLstate
+ Copyright © 2011, 2012 MLstate
This file is part of Opa.
@@ -324,20 +324,21 @@ let rec remove_all_symlinks path =
(** create all necessary directories to access a file path *)
let rec check_create_path ?(rights=0o755) ?(nobackslash=true) ?(isdirectory=false) path =
+ let path = remove_all_symlinks path in
let path = if isdirectory then Filename.concat path "test" else path in
let path = if nobackslash then Base.String.map (fun c -> if c='\\' then '/' else c) path else path in
let dirname = Filename.dirname path in
if dirname=path || dirname=".." || path="." || path="/" then (
true (*terminal case*)
- ) else
+ ) else
try
Sys.is_directory dirname || (
failwith ("Not a directory but exists: "^dirname)
)
(* terminal case *)
with Sys_error _ -> (
- check_create_path ~rights dirname
- && (try Unix.mkdir dirname rights; true with Unix.Unix_error _ -> Printf.printf "mkdir error%s\n" dirname; false)
+ check_create_path ~rights dirname
+ && (try Unix.mkdir dirname rights; true with Unix.Unix_error _ -> Printf.printf "mkdir error %s\n" dirname; false)
)
(** hopefully, this is the ultimate and portable version of cp *)
Please sign in to comment.
Something went wrong with that request. Please try again.