Skip to content

Commit 2ecbed8

Browse files
authored
fix(bundler): sidecar on Windows, closes #3446 (#3482)
1 parent 5a4e9ef commit 2ecbed8

4 files changed

Lines changed: 23 additions & 3 deletions

File tree

.changes/fix-windows-sidecar.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri-bundler": patch
3+
---
4+
5+
Fixes sidecar bundling on Windows.

examples/sidecar/src-tauri/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tooling/bundler/src/bundle/settings.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,11 @@ impl Settings {
495495
&self.project_out_directory
496496
}
497497

498+
/// Returns the target triple.
499+
pub fn target(&self) -> &str {
500+
&self.target
501+
}
502+
498503
/// Returns the architecture for the binary being bundled (e.g. "arm", "x86" or "x86_64").
499504
pub fn binary_arch(&self) -> &str {
500505
if self.target.starts_with("x86_64") {
@@ -634,6 +639,7 @@ impl Settings {
634639
.to_string_lossy()
635640
.replace(&format!("-{}", self.target), ""),
636641
);
642+
println!("{:?} {:?} {:?}", src, dest, self.target);
637643
common::copy_file(&src, &dest)?;
638644
}
639645
Ok(())

tooling/bundler/src/bundle/windows/msi/wix.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,13 +716,21 @@ pub fn build_wix_app_installer(
716716
fn generate_binaries_data(settings: &Settings) -> crate::Result<Vec<Binary>> {
717717
let mut binaries = Vec::new();
718718
let cwd = std::env::current_dir()?;
719+
let tmp_dir = std::env::temp_dir();
719720
for src in settings.external_binaries() {
720721
let src = src?;
722+
let binary_path = cwd.join(&src);
723+
let dest_filename = src
724+
.file_name()
725+
.expect("failed to extract external binary filename")
726+
.to_string_lossy()
727+
.replace(&format!("-{}", settings.target()), "");
728+
let dest = tmp_dir.join(dest_filename);
729+
std::fs::copy(binary_path, &dest)?;
721730

722731
binaries.push(Binary {
723732
guid: Uuid::new_v4().to_string(),
724-
path: cwd
725-
.join(src)
733+
path: dest
726734
.into_os_string()
727735
.into_string()
728736
.expect("failed to read external binary path"),

0 commit comments

Comments
 (0)