File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -82,11 +82,14 @@ fn install_prebuilt() {
82
82
let mut base_name = short_file_name. to_string ( ) ;
83
83
remove_suffix ( & mut base_name, ".tar.gz" ) ;
84
84
log_var ! ( base_name) ;
85
- let target_dir = PathBuf :: from ( & get ! ( "CARGO_MANIFEST_DIR" ) ) . join ( "target" ) ;
86
- if !target_dir. exists ( ) {
87
- fs:: create_dir ( & target_dir) . unwrap ( ) ;
85
+ let download_dir = match env:: var ( "TF_RUST_DOWNLOAD_DIR" ) {
86
+ Ok ( s) => PathBuf :: from ( s) ,
87
+ Err ( _) => PathBuf :: from ( & get ! ( "CARGO_MANIFEST_DIR" ) ) . join ( "target" ) ,
88
+ } ;
89
+ if !download_dir. exists ( ) {
90
+ fs:: create_dir ( & download_dir) . unwrap ( ) ;
88
91
}
89
- let file_name = target_dir . join ( short_file_name) ;
92
+ let file_name = download_dir . join ( short_file_name) ;
90
93
log_var ! ( file_name) ;
91
94
92
95
// Download the tarball.
@@ -107,7 +110,7 @@ fn install_prebuilt() {
107
110
}
108
111
109
112
// Extract the tarball.
110
- let unpacked_dir = target_dir . join ( base_name) ;
113
+ let unpacked_dir = download_dir . join ( base_name) ;
111
114
let lib_dir = unpacked_dir. join ( "lib" ) ;
112
115
if !lib_dir. join ( format ! ( "lib{}.so" , LIBRARY ) ) . exists ( ) {
113
116
extract ( file_name, & unpacked_dir) ;
You can’t perform that action at this time.
0 commit comments