Skip to content

Commit b0f2781

Browse files
authored
fix(cli): map --profile dev to debug folder when finding executable (#8776)
1 parent cc3d8e7 commit b0f2781

File tree

5 files changed

+34
-69
lines changed

5 files changed

+34
-69
lines changed

.changes/cli-dev-profile.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'tauri-cli': 'patch:bug'
3+
'@tauri-apps/cli': 'patch:bug'
4+
---
5+
6+
Fix `fail to rename app` when using `--profile dev`.

tooling/bundler/src/bundle/updater_bundle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ use std::{
2323
path::{Path, PathBuf},
2424
};
2525

26-
use flate2::{write::GzEncoder, Compression};
27-
2826
use anyhow::Context;
2927
use log::info;
3028
use zip::write::FileOptions;
@@ -236,6 +234,8 @@ pub fn create_zip(src_file: &Path, dst_file: &Path) -> crate::Result<PathBuf> {
236234

237235
#[cfg(not(target_os = "windows"))]
238236
fn create_tar(src_dir: &Path, dest_path: &Path) -> crate::Result<PathBuf> {
237+
use flate2::{write::GzEncoder, Compression};
238+
239239
let dest_file = common::create_file(dest_path)?;
240240
let gzip_encoder = GzEncoder::new(dest_file, Compression::default());
241241

tooling/cli/Cargo.lock

Lines changed: 13 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tooling/cli/src/interface/rust.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ impl AppSettings for RustAppSettings {
692692
.expect("Cargo manifest must have the `package.name` field");
693693

694694
let out_dir = self
695-
.out_dir(options.target.clone(), get_profile(options))
695+
.out_dir(options.target.clone(), get_profile_dir(options).to_string())
696696
.with_context(|| "failed to get project out directory")?;
697697

698698
let binary_extension: String = if self.target_triple.contains("windows") {
@@ -986,13 +986,20 @@ pub fn get_workspace_dir() -> crate::Result<PathBuf> {
986986
)
987987
}
988988

989-
pub fn get_profile(options: &Options) -> String {
989+
pub fn get_profile(options: &Options) -> &str {
990990
options
991991
.args
992992
.iter()
993993
.position(|a| a == "--profile")
994-
.map(|i| options.args[i + 1].clone())
995-
.unwrap_or_else(|| if options.debug { "debug" } else { "release" }.into())
994+
.map(|i| options.args[i + 1].as_str())
995+
.unwrap_or_else(|| if options.debug { "debug" } else { "release" })
996+
}
997+
998+
pub fn get_profile_dir(options: &Options) -> &str {
999+
match get_profile(options) {
1000+
"dev" => "debug",
1001+
profile => profile,
1002+
}
9961003
}
9971004

9981005
#[allow(unused_variables)]

tooling/cli/src/interface/rust/desktop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33
// SPDX-License-Identifier: MIT
44

5-
use super::{get_profile, AppSettings, DevChild, ExitReason, Options, RustAppSettings, Target};
5+
use super::{get_profile_dir, AppSettings, DevChild, ExitReason, Options, RustAppSettings, Target};
66
use crate::CommandExt;
77
use tauri_utils::display_path;
88

@@ -125,7 +125,7 @@ pub fn build(
125125
options.target.replace(triple.into());
126126

127127
let triple_out_dir = app_settings
128-
.out_dir(Some(triple.into()), get_profile(&options))
128+
.out_dir(Some(triple.into()), get_profile_dir(&options).to_string())
129129
.with_context(|| format!("failed to get {triple} out dir"))?;
130130

131131
build_production_app(options, available_targets, config_features.clone())

0 commit comments

Comments
 (0)