Skip to content

Commit

Permalink
Merge pull request #130 from janestreet/408
Browse files Browse the repository at this point in the history
Support for OCaml 4.08
  • Loading branch information
xclerc authored May 29, 2019
2 parents 3e165b8 + bace9be commit 0df63d5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/core_unix.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1240,14 +1240,22 @@ let unlink = unary_filename Unix.unlink

let rename = src_dst Unix.rename

[%%if ocaml_version >= (4, 08, 0)]
let unix_link ~src ~dst =
Unix.link ~src ~dst ?follow:None
[%%else]
let unix_link ~src ~dst =
Unix.link ~src ~dst
[%%endif]

let link ?(force = false) ~target ~link_name () =
improve
(fun () ->
if force then begin
try Unix.unlink link_name
with Unix_error (Unix.ENOENT, _, _) -> ()
end;
Unix.link ~src:target ~dst:link_name)
unix_link ~src:target ~dst:link_name)
(fun () -> [("target", atom target); ("link_name", atom link_name)])
;;

Expand Down

0 comments on commit 0df63d5

Please sign in to comment.