Make is_directory work when dir doesn't exist
This commit is contained in:
parent
829b85ec44
commit
1a8c328b2d
|
@ -40,9 +40,7 @@ let load ?(extra_ignored_subtrees=Path.Set.empty) path =
|
|||
Path.readdir path
|
||||
|> List.filter_map ~f:(fun fn ->
|
||||
let path = Path.relative path fn in
|
||||
let is_directory =
|
||||
try Path.is_directory path with _ -> false
|
||||
in
|
||||
let is_directory = Path.is_directory path in
|
||||
if ignore_file fn ~is_directory then
|
||||
None
|
||||
else if is_directory then
|
||||
|
|
|
@ -381,7 +381,9 @@ let drop_build_context t =
|
|||
|
||||
let exists t = Sys.file_exists (to_string t)
|
||||
let readdir t = Sys.readdir (to_string t) |> Array.to_list
|
||||
let is_directory t = Sys.is_directory (to_string t)
|
||||
let is_directory t =
|
||||
try Sys.is_directory (to_string t)
|
||||
with Sys_error _ -> false
|
||||
let rmdir t = Unix.rmdir (to_string t)
|
||||
let unlink t = Unix.unlink (to_string t)
|
||||
let unlink_no_err t = try Unix.unlink (to_string t) with _ -> ()
|
||||
|
|
Loading…
Reference in New Issue