Skip to content

Commit

Permalink
fix(cli.rs): fix out dir detection when target arg is set, closes #2040
Browse files Browse the repository at this point in the history
… (#2098)
  • Loading branch information
lucasfernog authored Jun 28, 2021
1 parent d18b536 commit 8e23870
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-cli-target-set.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"cli.rs": patch
---

Fixes `build` command when the `target` arg is set.
2 changes: 1 addition & 1 deletion tooling/cli.rs/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl Build {
let app_settings = crate::interface::rust::AppSettings::new(config_)?;

let out_dir = app_settings
.get_out_dir(self.debug)
.get_out_dir(self.target.clone(), self.debug)
.with_context(|| "failed to get project out directory")?;
if let Some(product_name) = config_.package.product_name.clone() {
let bin_name = app_settings.cargo_package_settings().name.clone();
Expand Down
2 changes: 1 addition & 1 deletion tooling/cli.rs/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl Dev {
let config_ = config_guard.as_ref().unwrap();
let app_settings = crate::interface::rust::AppSettings::new(config_)?;
let out_dir = app_settings
.get_out_dir(true)
.get_out_dir(self.target.clone(), true)
.with_context(|| "failed to get project out directory")?;
let settings = crate::interface::get_bundler_settings(
app_settings,
Expand Down
4 changes: 2 additions & 2 deletions tooling/cli.rs/src/interface/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ impl AppSettings {
)
}

pub fn get_out_dir(&self, debug: bool) -> crate::Result<PathBuf> {
pub fn get_out_dir(&self, target: Option<String>, debug: bool) -> crate::Result<PathBuf> {
let tauri_dir = tauri_dir();
let workspace_dir = get_workspace_dir(&tauri_dir);
get_target_dir(&workspace_dir, None, !debug)
get_target_dir(&workspace_dir, target, !debug)
}

pub fn get_package_settings(&self) -> PackageSettings {
Expand Down

0 comments on commit 8e23870

Please sign in to comment.