@@ -10,7 +10,7 @@ use crate::utils::{
10
10
} ;
11
11
12
12
pub ( crate ) fn prepare ( dirs : & Dirs ) {
13
- RelPath :: DOWNLOAD . ensure_exists ( dirs) ;
13
+ std :: fs :: create_dir_all ( & dirs. download_dir ) . unwrap ( ) ;
14
14
crate :: tests:: RAND_REPO . fetch ( dirs) ;
15
15
crate :: tests:: REGEX_REPO . fetch ( dirs) ;
16
16
}
@@ -81,13 +81,13 @@ impl GitRepo {
81
81
82
82
fn download_dir ( & self , dirs : & Dirs ) -> PathBuf {
83
83
match self . url {
84
- GitRepoUrl :: Github { user : _, repo } => RelPath :: DOWNLOAD . join ( repo) . to_path ( dirs) ,
84
+ GitRepoUrl :: Github { user : _, repo } => RelPath :: download ( repo) . to_path ( dirs) ,
85
85
}
86
86
}
87
87
88
88
pub ( crate ) const fn source_dir ( & self ) -> RelPath {
89
89
match self . url {
90
- GitRepoUrl :: Github { user : _, repo } => RelPath :: BUILD . join ( repo) ,
90
+ GitRepoUrl :: Github { user : _, repo } => RelPath :: build ( repo) ,
91
91
}
92
92
}
93
93
@@ -115,7 +115,7 @@ impl GitRepo {
115
115
}
116
116
117
117
let source_lockfile =
118
- RelPath :: PATCHES . to_path ( dirs ) . join ( format ! ( "{}-lock.toml" , self . patch_name) ) ;
118
+ dirs . source_dir . join ( "patches" ) . join ( format ! ( "{}-lock.toml" , self . patch_name) ) ;
119
119
let target_lockfile = download_dir. join ( "Cargo.lock" ) ;
120
120
if source_lockfile. exists ( ) {
121
121
assert ! ( !target_lockfile. exists( ) ) ;
@@ -170,8 +170,8 @@ fn clone_repo_shallow_github(dirs: &Dirs, download_dir: &Path, user: &str, repo:
170
170
}
171
171
172
172
let archive_url = format ! ( "https://github.com/{}/{}/archive/{}.tar.gz" , user, repo, rev) ;
173
- let archive_file = RelPath :: DOWNLOAD . to_path ( dirs) . join ( format ! ( "{}.tar.gz" , rev) ) ;
174
- let archive_dir = RelPath :: DOWNLOAD . to_path ( dirs) . join ( format ! ( "{}-{}" , repo, rev) ) ;
173
+ let archive_file = dirs. download_dir . join ( format ! ( "{}.tar.gz" , rev) ) ;
174
+ let archive_dir = dirs. download_dir . join ( format ! ( "{}-{}" , repo, rev) ) ;
175
175
176
176
eprintln ! ( "[DOWNLOAD] {}/{} from {}" , user, repo, archive_url) ;
177
177
@@ -201,7 +201,7 @@ fn clone_repo_shallow_github(dirs: &Dirs, download_dir: &Path, user: &str, repo:
201
201
202
202
// Unpack tar archive
203
203
let mut unpack_cmd = Command :: new ( "tar" ) ;
204
- unpack_cmd. arg ( "xf" ) . arg ( & archive_file) . current_dir ( RelPath :: DOWNLOAD . to_path ( dirs) ) ;
204
+ unpack_cmd. arg ( "xf" ) . arg ( & archive_file) . current_dir ( & dirs. download_dir ) ;
205
205
spawn_and_wait ( unpack_cmd) ;
206
206
207
207
// Rename unpacked dir to the expected name
@@ -226,7 +226,7 @@ fn init_git_repo(repo_dir: &Path) {
226
226
}
227
227
228
228
fn get_patches ( dirs : & Dirs , crate_name : & str ) -> Vec < PathBuf > {
229
- let mut patches: Vec < _ > = fs:: read_dir ( RelPath :: PATCHES . to_path ( dirs ) )
229
+ let mut patches: Vec < _ > = fs:: read_dir ( dirs . source_dir . join ( "patches" ) )
230
230
. unwrap ( )
231
231
. map ( |entry| entry. unwrap ( ) . path ( ) )
232
232
. filter ( |path| path. extension ( ) == Some ( OsStr :: new ( "patch" ) ) )
0 commit comments