Skip to content

Commit

Permalink
refactor: simplify file existence check
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>

<!-- ps-id: feab1807-5a74-43f1-949b-aa4f58f517bd -->
  • Loading branch information
rgrinberg committed Jun 6, 2023
1 parent 0f773b6 commit ee2f8d6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ocaml-lsp-server/src/merlin_config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,9 @@ let get_config (p : Process.t) ~workdir path_abs =
] )

let file_exists fname =
(* XXX stat? *)
Sys.file_exists fname && not (Sys.is_directory fname)
match Unix.stat fname with
| exception Unix.Unix_error (Unix.ENOENT, _, _) -> false
| s -> s.st_kind <> S_DIR

let find_project_context start_dir =
(* The workdir is the first directory we find which contains a [dune] file. We
Expand Down

0 comments on commit ee2f8d6

Please sign in to comment.