Skip to content

Commit de1ac0c

Browse files
committed
generate path with windows compatibility
1 parent 88d0fa2 commit de1ac0c

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,23 @@ jobs:
3232
- uses: Swatinem/[email protected]
3333
with:
3434
key: ${{ matrix.feature }}${{ matrix.os }}
35-
if: ${{ matrix.os != 'macos-10.15' }} # issue with hard-links on mac
35+
if: ${{ matrix.os != 'macos-11' }} # issue with hard-links on mac
3636
- uses: actions-rs/toolchain@v1
3737
with:
3838
toolchain: stable
3939
override: true
4040
#- run: echo "TEMPDIR_ROOT=/dev/shm" >> $GITHUB_ENV # conflicts with test `test_data_persistence`
41-
if: ${{ matrix.os != 'macos-10.15' }}
41+
# if: ${{ matrix.os != 'macos-11' }}
4242
- uses: actions-rs/cargo@v1
4343
with:
4444
command: test
4545
args: --features ${{ matrix.feature }}
4646
- run: echo "BITCOIND_EXE=$(find ./target/debug -name bitcoind)" >> $GITHUB_ENV
47+
if: ${{ matrix.os != 'windows-2019' }}
4748
- uses: actions-rs/cargo@v1
4849
with:
4950
command: test
50-
if: ${{ matrix.feature != '0_18_1' && matrix.feature != '0_18_0' && matrix.feature != '0_17_1' }} # would fail `test_multi_wallet`
51+
if: ${{ matrix.feature != '0_18_1' && matrix.feature != '0_18_0' && matrix.feature != '0_17_1' && matrix.os != 'windows-2019' }} # would fail `test_multi_wallet`
5152

5253

5354
cosmetics:

build.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,10 @@ fn main() {
135135
};
136136

137137
if outpath.file_name().map(|s| s.to_str()) == Some(Some("bitcoind.exe")) {
138-
bitcoin_exe_home.push(outpath);
139-
std::fs::create_dir_all(&bitcoin_exe_home).unwrap();
138+
for d in outpath.iter() {
139+
bitcoin_exe_home.push(d);
140+
}
141+
std::fs::create_dir_all(&bitcoin_exe_home.parent().unwrap()).unwrap();
140142
println!("{:?}", bitcoin_exe_home);
141143
let mut outfile = std::fs::File::create(&bitcoin_exe_home).unwrap();
142144
io::copy(&mut file, &mut outfile).unwrap();

src/lib.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -416,18 +416,19 @@ impl From<bitcoincore_rpc::Error> for Error {
416416

417417
/// Provide the bitcoind executable path if a version feature has been specified
418418
pub fn downloaded_exe_path() -> Result<String, Error> {
419-
let ext = if cfg!(target_os = "windows") {
420-
".exe"
421-
} else {
422-
""
423-
};
424419
if versions::HAS_FEATURE {
425-
Ok(format!(
426-
"{}/bitcoin/bitcoin-{}/bin/bitcoind{}",
427-
env!("OUT_DIR"),
428-
versions::VERSION,
429-
ext
430-
))
420+
let mut path: PathBuf = env!("OUT_DIR").into();
421+
path.push("bitcoin");
422+
path.push(format!("bitcoin-{}", versions::VERSION));
423+
path.push("bin");
424+
425+
if cfg!(target_os = "windows") {
426+
path.push("bitcoind.exe");
427+
} else {
428+
path.push("bitcoind");
429+
}
430+
431+
Ok(format!("{}", path.display()))
431432
} else {
432433
Err(Error::NoFeature)
433434
}

0 commit comments

Comments
 (0)