-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Path.mkdirs #594
Add Path.mkdirs #594
Conversation
Hmm I think the Linux error (or the macOS/Windows incorrect success) is caused by catching Line 158 in 355f8da
|
lib_eio/path.ml
Outdated
make_directory dir; | ||
loop dir xs | ||
in | ||
loop "" (separate path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably more efficient to start by checking the direct parent. If that exists (which is the common) case, there's no need to check further up (see e.g. Python's makedirs or Bos's create).
(** [mkdir ?exist_ok ~perm t] creates a new directory [t] with permissions [perm]. *) | ||
|
||
val mkdirs : ?exists_ok:bool -> perm:File.Unix_perm.t -> _ t -> unit | ||
(** Recursively create directories. If [exist_ok] is [false] (the default) then we raise |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exists_ok
should only affect the final directory, not the intermediate ones (most of which will exist).
Closing in favour of the newer version in #625 - thanks! |
As per one of the tasks in #510. I'm almost certainly doing something wrong... Unfortunately I don't have a windows machine so I blindly added the windows test.