@@ -6,7 +6,7 @@ use crate::path::{Dirs, RelPath};
6
6
use crate :: prepare:: apply_patches;
7
7
use crate :: rustc_info:: { get_default_sysroot, get_file_name} ;
8
8
use 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 ,
10
10
} ;
11
11
use crate :: { config, CodegenBackend , SysrootKind } ;
12
12
@@ -24,8 +24,7 @@ pub(crate) fn build_sysroot(
24
24
25
25
let dist_dir = RelPath :: DIST . to_path ( dirs) ;
26
26
27
- remove_dir_if_exists ( & dist_dir) ;
28
- fs:: create_dir_all ( & dist_dir) . unwrap ( ) ;
27
+ ensure_empty_dir ( & dist_dir) ;
29
28
fs:: create_dir_all ( dist_dir. join ( "bin" ) ) . unwrap ( ) ;
30
29
fs:: create_dir_all ( dist_dir. join ( "lib" ) ) . unwrap ( ) ;
31
30
@@ -223,7 +222,7 @@ fn build_clif_sysroot_for_triple(
223
222
if !config:: get_bool ( "keep_sysroot" ) {
224
223
// Cleanup the deps dir, but keep build scripts and the incremental cache for faster
225
224
// 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" ) ) ;
227
226
}
228
227
229
228
// Build sysroot
0 commit comments