File tree Expand file tree Collapse file tree 3 files changed +11
-12
lines changed Expand file tree Collapse file tree 3 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ ureq = "2.1"
22
22
bitcoin_hashes = " 0.10"
23
23
flate2 = " 1.0"
24
24
tar = " 0.4"
25
- home = " 0.5.3"
26
25
27
26
[features ]
28
27
"0_21_1" = []
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ use bitcoin_hashes::{sha256, Hash};
2
2
use flate2:: read:: GzDecoder ;
3
3
use std:: fs:: File ;
4
4
use std:: io:: { BufRead , BufReader , Read } ;
5
- use std:: path:: PathBuf ;
5
+ use std:: path:: Path ;
6
6
use std:: str:: FromStr ;
7
7
use tar:: Archive ;
8
8
@@ -36,14 +36,15 @@ fn main() {
36
36
}
37
37
let download_filename = download_filename ( ) ;
38
38
let expected_hash = get_expected_sha256 ( & download_filename) . unwrap ( ) ;
39
- let bitcoin_exe_home = format ! (
40
- "{}/bitcoin" ,
41
- home:: cargo_home( )
42
- . expect( "cannot determine CARGO_HOME" )
43
- . display( )
44
- ) ;
45
- let existing_filename: PathBuf =
46
- format ! ( "{}/bitcoin-{}/bin/bitcoind" , & bitcoin_exe_home, VERSION ) . into ( ) ;
39
+ let out_dir = std:: env:: var_os ( "OUT_DIR" ) . unwrap ( ) ;
40
+ let bitcoin_exe_home = Path :: new ( & out_dir) . join ( "bitcoin" ) ;
41
+ if !bitcoin_exe_home. exists ( ) {
42
+ std:: fs:: create_dir ( & bitcoin_exe_home) . unwrap ( ) ;
43
+ }
44
+ let existing_filename = bitcoin_exe_home
45
+ . join ( format ! ( "bitcoin-{}" , VERSION ) )
46
+ . join ( "bin" )
47
+ . join ( "bicoind" ) ;
47
48
48
49
if !existing_filename. exists ( ) {
49
50
println ! (
Original file line number Diff line number Diff line change @@ -279,11 +279,10 @@ impl From<bitcoincore_rpc::Error> for Error {
279
279
280
280
/// Provide the bitcoind executable path if a version feature has been specified
281
281
pub fn downloaded_exe_path ( ) -> Option < String > {
282
- // CARGO_HOME surely available only in `build.rs` here we need to get from home_dir
283
282
if versions:: HAS_FEATURE {
284
283
Some ( format ! (
285
284
"{}/bitcoin/bitcoin-{}/bin/bitcoind" ,
286
- home :: cargo_home ( ) . ok ( ) ? . display ( ) ,
285
+ env! ( "OUT_DIR" ) ,
287
286
versions:: VERSION
288
287
) )
289
288
} else {
You can’t perform that action at this time.
0 commit comments