Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Mokhov <[email protected]>
  • Loading branch information
snowleopard committed Apr 26, 2021
1 parent 953cf4e commit 7546aba
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions otherlibs/stdune-unstable/fpath.ml
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ let unlink_no_err t =

type clear_dir_result =
| Cleared
| Does_not_exist
| Directory_does_not_exist

let rec clear_dir dir =
match Dune_filesystem_stubs.read_directory_with_kinds dir with
| Error ENOENT -> Does_not_exist
| Error ENOENT -> Directory_does_not_exist
| Error error ->
raise
(Unix.Unix_error
Expand All @@ -116,7 +116,7 @@ let rec clear_dir dir =
and rm_rf_dir path =
match clear_dir path with
| Cleared -> Unix.rmdir path
| Does_not_exist -> ()
| Directory_does_not_exist -> ()

let rm_rf ?(allow_external = false) fn =
if (not allow_external) && not (Filename.is_relative fn) then
Expand Down
4 changes: 2 additions & 2 deletions otherlibs/stdune-unstable/fpath.mli
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ val initial_cwd : string

type clear_dir_result =
| Cleared
| Does_not_exist
| Directory_does_not_exist

val clear_dir : string -> clear_dir_result

(** If the directory does not exist, this function is a no-op. *)
(** If the given path does not exist, this function is a no-op. *)
val rm_rf : ?allow_external:bool -> string -> unit
2 changes: 1 addition & 1 deletion otherlibs/stdune-unstable/temp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ let destroy what fn =
let clear_dir dir =
(match Path.clear_dir dir with
| Cleared -> ()
| Does_not_exist ->
| Directory_does_not_exist ->
(* We can end up here if nested temporary directories are cleared starting
from the outermost directory. It's OK to do nothing in this case. *)
());
Expand Down

0 comments on commit 7546aba

Please sign in to comment.