Skip to content

Commit

Permalink
refactor: simplify file existence check (#1120)
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
  • Loading branch information
rgrinberg committed Jun 6, 2023
1 parent 32ee70d commit 9648a05
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ocaml-lsp-server/src/merlin_config.ml
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 9648a05

Please sign in to comment.