@@ -6,7 +6,7 @@ use crate::path::{Dirs, RelPath};
66use crate :: prepare:: apply_patches;
77use crate :: rustc_info:: { get_default_sysroot, get_file_name} ;
88use crate :: utils:: {
9- remove_dir_if_exists , spawn_and_wait, try_hard_link, CargoProject , Compiler , LogGroup ,
9+ ensure_empty_dir , spawn_and_wait, try_hard_link, CargoProject , Compiler , LogGroup ,
1010} ;
1111use crate :: { config, CodegenBackend , SysrootKind } ;
1212
@@ -24,8 +24,7 @@ pub(crate) fn build_sysroot(
2424
2525 let dist_dir = RelPath :: DIST . to_path ( dirs) ;
2626
27- remove_dir_if_exists ( & dist_dir) ;
28- fs:: create_dir_all ( & dist_dir) . unwrap ( ) ;
27+ ensure_empty_dir ( & dist_dir) ;
2928 fs:: create_dir_all ( dist_dir. join ( "bin" ) ) . unwrap ( ) ;
3029 fs:: create_dir_all ( dist_dir. join ( "lib" ) ) . unwrap ( ) ;
3130
@@ -223,7 +222,7 @@ fn build_clif_sysroot_for_triple(
223222 if !config:: get_bool ( "keep_sysroot" ) {
224223 // Cleanup the deps dir, but keep build scripts and the incremental cache for faster
225224 // recompilation as they are not affected by changes in cg_clif.
226- remove_dir_if_exists ( & build_dir. join ( "deps" ) ) ;
225+ ensure_empty_dir ( & build_dir. join ( "deps" ) ) ;
227226 }
228227
229228 // Build sysroot
0 commit comments