Actually remove directories (#9849)
`rm_rf` removed the files (recursively) but not the directories.master
parent
53fe14a541
commit
781b37b688
6
Changes
6
Changes
|
@ -315,9 +315,9 @@ Working version
|
|||
attributes are present.
|
||||
(Matthew Ryan, review by Nicolás Ojeda Bär)
|
||||
|
||||
- #9797: Eliminate the routine use of external commands in ocamltest. ocamltest
|
||||
no longer calls the mkdir, rm and ln external commands (at present, the only
|
||||
external command ocamltest uses is diff).
|
||||
- #9797, #9849: Eliminate the routine use of external commands in ocamltest.
|
||||
ocamltest no longer calls the mkdir, rm and ln external commands (at present,
|
||||
the only external command ocamltest uses is diff).
|
||||
(David Allsopp, review by Nicolás Ojeda Bär, Sébastien Hinderer and
|
||||
Xavier Leroy)
|
||||
|
||||
|
|
|
@ -94,10 +94,11 @@ module Sys = struct
|
|||
|
||||
let rm_rf path =
|
||||
let rec erase path =
|
||||
if Sys.is_directory path
|
||||
then Array.iter (fun entry -> erase (Filename.concat path entry))
|
||||
(Sys.readdir path)
|
||||
else erase_file path
|
||||
if Sys.is_directory path then begin
|
||||
Array.iter (fun entry -> erase (Filename.concat path entry))
|
||||
(Sys.readdir path);
|
||||
Sys.rmdir path
|
||||
end else erase_file path
|
||||
in
|
||||
try if Sys.file_exists path then erase path
|
||||
with Sys_error err ->
|
||||
|
|
Loading…
Reference in New Issue