Skip to content

Commit 9648a05

Browse files
authored
refactor: simplify file existence check (#1120)
Signed-off-by: Rudi Grinberg <[email protected]>
1 parent 32ee70d commit 9648a05

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ocaml-lsp-server/src/merlin_config.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,9 @@ let get_config (p : Process.t) ~workdir path_abs =
321321
] )
322322

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

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

0 commit comments

Comments
 (0)