Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
|
|
@ -1,14 +1,7 @@
|
|||
#load "unix.cma"
|
||||
|
||||
let mkdir_p ~path ~perms =
|
||||
let ps = String.split_on_char '/' path in
|
||||
let rec aux acc = function [] -> ()
|
||||
| p::ps ->
|
||||
let this = String.concat Filename.dir_sep (List.rev (p::acc)) in
|
||||
Unix.mkdir this perms;
|
||||
aux (p::acc) ps
|
||||
in
|
||||
aux [] ps
|
||||
|
||||
let () =
|
||||
mkdir_p "path/to/dir" 0o700
|
||||
let rec mkdir_p path perm =
|
||||
if path <> "" then
|
||||
try Unix.mkdir path perm with
|
||||
| Unix.Unix_error (EEXIST, _, _) when Sys.is_directory path -> ()
|
||||
| Unix.Unix_error (ENOENT, _, _) ->
|
||||
mkdir_p (Filename.dirname path) perm;
|
||||
Unix.mkdir path perm
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue