diff --git a/src/file_tree.ml b/src/file_tree.ml index 5649d2c7..b82f4379 100644 --- a/src/file_tree.ml +++ b/src/file_tree.ml @@ -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 diff --git a/src/path.ml b/src/path.ml index 5763baac..6654d72e 100644 --- a/src/path.ml +++ b/src/path.ml @@ -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 _ -> ()