From bcf000c0a8607eedf488fb949b982f519abda43d Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Thu, 28 Aug 2025 18:02:46 -0300 Subject: [PATCH] fix(cli): ios command failing when running with deno, closes #13547 (#14110) Deno doesn't set an environment variable to help us, so I had to use the exe path to determine whether we're running under deno or not --- .changes/fix-deno-cli-ios.md | 6 ++++++ crates/tauri-cli/src/mobile/ios/xcode_script.rs | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 .changes/fix-deno-cli-ios.md diff --git a/.changes/fix-deno-cli-ios.md b/.changes/fix-deno-cli-ios.md new file mode 100644 index 000000000..8e2b6698c --- /dev/null +++ b/.changes/fix-deno-cli-ios.md @@ -0,0 +1,6 @@ +--- +"tauri-cli": patch:bug +"@tauri-apps/cli": patch:bug +--- + +Fixes running `ios` commands with `deno` crashing due to incorrect current working directory resolution. diff --git a/crates/tauri-cli/src/mobile/ios/xcode_script.rs b/crates/tauri-cli/src/mobile/ios/xcode_script.rs index dc911f04b..0217aaa80 100644 --- a/crates/tauri-cli/src/mobile/ios/xcode_script.rs +++ b/crates/tauri-cli/src/mobile/ios/xcode_script.rs @@ -65,12 +65,16 @@ pub fn command(options: Options) -> Result<()> { } } - // `xcode-script` is ran from the `gen/apple` folder when not using NPM/yarn/pnpm. + let process_path = std::env::current_exe().unwrap_or_default(); + + // `xcode-script` is ran from the `gen/apple` folder when not using NPM/yarn/pnpm/deno. // so we must change working directory to the src-tauri folder to resolve the tauri dir // additionally, bun@<1.2 does not modify the current working directory, so it is also runs this script from `gen/apple` // bun@>1.2 now actually moves the CWD to the package root so we shouldn't modify CWD in that case // see https://bun.sh/blog/bun-v1.2#bun-run-uses-the-correct-directory - if (var_os("npm_lifecycle_event").is_none() && var_os("PNPM_PACKAGE_NAME").is_none()) + if (var_os("npm_lifecycle_event").is_none() + && var_os("PNPM_PACKAGE_NAME").is_none() + && process_path.file_stem().unwrap_or_default() != "deno") || var("npm_config_user_agent") .is_ok_and(|agent| agent.starts_with("bun/1.0") || agent.starts_with("bun/1.1")) {