Get rid of Path.is_file
This commit is contained in:
parent
5eb444e357
commit
e310f17237
|
@ -649,7 +649,7 @@ module Promotion = struct
|
|||
let dump_db db =
|
||||
if Sys.file_exists "_build" then begin
|
||||
match db with
|
||||
| [] -> if Path.is_file db_file then Path.unlink_no_err db_file
|
||||
| [] -> if Path.exists db_file then Path.unlink_no_err db_file
|
||||
| l ->
|
||||
Io.write_file db_file
|
||||
(String.concat ~sep:""
|
||||
|
@ -657,7 +657,7 @@ module Promotion = struct
|
|||
end
|
||||
|
||||
let load_db () =
|
||||
if Path.is_file db_file then
|
||||
if Path.exists db_file then
|
||||
Io.Sexp.load db_file ~mode:Many
|
||||
|> List.map ~f:File.t
|
||||
else
|
||||
|
|
|
@ -19,7 +19,7 @@ module Promoted_to_delete = struct
|
|||
let add p = db := p :: !db
|
||||
|
||||
let load () =
|
||||
if Path.is_file fn then
|
||||
if Path.exists fn then
|
||||
Io.Sexp.load fn ~mode:Many
|
||||
|> List.map ~f:Path.t
|
||||
else
|
||||
|
@ -1123,7 +1123,7 @@ module Trace = struct
|
|||
|
||||
let load () =
|
||||
let trace = Hashtbl.create 1024 in
|
||||
if Path.is_file file then begin
|
||||
if Path.exists file then begin
|
||||
let sexp = Io.Sexp.load file ~mode:Single in
|
||||
let bindings =
|
||||
let open Sexp.Of_sexp in
|
||||
|
@ -1203,7 +1203,7 @@ let update_universe t =
|
|||
(* To workaround the fact that [mtime] is not precise enough on OSX *)
|
||||
Utils.Cached_digest.remove universe_file;
|
||||
let n =
|
||||
if Path.is_file universe_file then
|
||||
if Path.exists universe_file then
|
||||
Sexp.Of_sexp.int (Io.Sexp.load ~mode:Single universe_file) + 1
|
||||
else
|
||||
0
|
||||
|
|
|
@ -85,7 +85,7 @@ let load_config_file p =
|
|||
t (Io.Sexp.load_many_as_one p)
|
||||
|
||||
let load_user_config_file () =
|
||||
if Path.is_file user_config_file then
|
||||
if Path.exists user_config_file then
|
||||
load_config_file user_config_file
|
||||
else
|
||||
default
|
||||
|
|
|
@ -55,7 +55,7 @@ let setup ?(log=Log.no_log)
|
|||
match workspace with
|
||||
| Some w -> w
|
||||
| None ->
|
||||
if Path.is_file workspace_file then
|
||||
if Path.exists workspace_file then
|
||||
Workspace.load ?x workspace_file
|
||||
else
|
||||
{ merlin_context = Some "default"
|
||||
|
|
|
@ -431,9 +431,6 @@ let readdir t = Sys.readdir (to_string t) |> Array.to_list
|
|||
let is_directory t =
|
||||
try Sys.is_directory (to_string t)
|
||||
with Sys_error _ -> false
|
||||
let is_file t =
|
||||
try Sys.file_exists (to_string t)
|
||||
with Sys_error _ -> false
|
||||
let rmdir t = Unix.rmdir (to_string t)
|
||||
let win32_unlink fn =
|
||||
try
|
||||
|
|
|
@ -127,7 +127,6 @@ val insert_after_build_dir_exn : t -> string -> t
|
|||
val exists : t -> bool
|
||||
val readdir : t -> string list
|
||||
val is_directory : t -> bool
|
||||
val is_file : t -> bool
|
||||
val rmdir : t -> unit
|
||||
val unlink : t -> unit
|
||||
val unlink_no_err : t -> unit
|
||||
|
|
|
@ -203,7 +203,7 @@ module Cached_digest = struct
|
|||
Io.write_file db_file (Sexp.to_string sexp)
|
||||
|
||||
let load () =
|
||||
if Path.is_file db_file then begin
|
||||
if Path.exists db_file then begin
|
||||
let sexp = Io.Sexp.load db_file ~mode:Single in
|
||||
let bindings =
|
||||
let open Sexp.Of_sexp in
|
||||
|
|
Loading…
Reference in New Issue