Do not remove sub-directories in `Compiler_utils.clean_dir'

This commit is contained in:
Nicolas Berthier 2018-03-02 14:27:15 +00:00
parent 95bb1a72ad
commit 8872bb3998

View file

@ -107,7 +107,10 @@ let build_path suf =
let clean_dir dir =
if Sys.file_exists dir && Sys.is_directory dir
then begin
let rm_file_in_dir fn = Sys.remove (Filename.concat dir fn) in
let rm_file_in_dir fn =
let f = Filename.concat dir fn in
if not (Sys.is_directory f) then Sys.remove f
in
Array.iter rm_file_in_dir (Sys.readdir dir);
end else Unix.mkdir dir 0o740;
dir