Skip to content

Commit 189f13c

Browse files
committed
patch dir-to-file on MingW
1 parent d944a82 commit 189f13c

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/sys/stm_tests.ml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,14 @@ struct
236236
(* temporary workaround for dir-to-empty-target-dir https://github.com/ocaml/ocaml/issues/12073 *)
237237
if Sys.win32 && path_is_an_empty_dir fs new_path then fs else
238238
(* temporary workaround for dir-to-file https://github.com/ocaml/ocaml/issues/12073 *)
239-
if (Sys.win32 && path_is_an_empty_dir fs new_path) ||
240-
(not (Model.mem fs new_path) || path_is_an_empty_dir fs new_path) then Model.rename fs old_path new_path else fs)
239+
if (Sys.win32 && path_is_file fs new_path) then
240+
(match Model.separate_path new_path in
241+
| None -> fs
242+
| Some (new_path_pref, new_name) ->
243+
let fs = remove fs new_path_pref new_name in
244+
Model.rename fs old_path new_path)
245+
else
246+
if (not (Model.mem fs new_path) || path_is_an_empty_dir fs new_path) then Model.rename fs old_path new_path else fs)
241247
| Is_directory _path -> fs
242248
| Rmdir (path,delete_dir_name) ->
243249
let complete_path = path @ [delete_dir_name] in

0 commit comments

Comments
 (0)