Ignore Sys_error in Path.exists

This commit is contained in:
Rudi Grinberg 2018-04-25 18:12:45 +07:00
parent 62aa5acab3
commit 4b2a609396
1 changed files with 3 additions and 1 deletions

View File

@ -426,7 +426,9 @@ let explode_exn t =
Exn.code_error "Path.explode_exn"
["path", Sexp.atom_or_quoted_string t]
let exists t = Sys.file_exists (to_string t)
let exists t =
try Sys.file_exists (to_string t)
with Sys_error _ -> false
let readdir t = Sys.readdir (to_string t) |> Array.to_list
let is_directory t =
try Sys.is_directory (to_string t)