Skip to content

Commit 1749590

Browse files
authored
chore: remove Path.touch (#8897)
It has been unused since #4465. Signed-off-by: Etienne Millon <[email protected]>
1 parent f4e6d0d commit 1749590

File tree

3 files changed

+1
-24
lines changed

3 files changed

+1
-24
lines changed

otherlibs/stdune/src/path.ml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,28 +1184,6 @@ let mkdir_p ?perms = function
11841184
(Outside_build_dir.append_local (Fdecl.get Build.build_dir) k)
11851185
;;
11861186

1187-
let touch ?(create = true) p =
1188-
let p =
1189-
match p with
1190-
| External s -> External.to_string s
1191-
| In_source_tree s -> Local_gen.to_string s
1192-
| In_build_dir k ->
1193-
Outside_build_dir.to_string
1194-
(Outside_build_dir.append_local (Fdecl.get Build.build_dir) k)
1195-
in
1196-
let create =
1197-
if create
1198-
then fun () -> Unix.close (Unix.openfile p [ Unix.O_CREAT ] 0o777)
1199-
else Fun.id
1200-
in
1201-
try Unix.utimes p 0.0 0.0 with
1202-
| Unix.Unix_error (Unix.ENOENT, _, _) -> create ()
1203-
| Unix.Unix_error (Unix.EUNKNOWNERR 0, _, _) when Sys.win32 && not (Sys.file_exists p)
1204-
->
1205-
(* OCaml PR#8857 *)
1206-
create ()
1207-
;;
1208-
12091187
let extension t =
12101188
match t with
12111189
| External t -> External.extension t

otherlibs/stdune/src/path.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,6 @@ val rm_rf : ?allow_external:bool -> t -> unit
366366
val clear_dir : t -> Fpath.clear_dir_result
367367

368368
val mkdir_p : ?perms:int -> t -> unit
369-
val touch : ?create:bool -> t -> unit
370369
val build_dir_exists : unit -> bool
371370
val ensure_build_dir_exists : unit -> unit
372371
val source : Source.t -> t

otherlibs/stdune/test/temp_tests.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ let () = init ()
66

77
let%expect_test "Temp.clear_dir works" =
88
let path = Temp.create Dir ~prefix:"dune" ~suffix:"unit_test" in
9-
Path.touch (Path.relative path "foo");
9+
Io.write_file (Path.relative path "foo") "";
1010
let print () =
1111
Path.readdir_unsorted path |> Result.to_dyn (list string) opaque |> print_dyn
1212
in

0 commit comments

Comments
 (0)