Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/android-init-windows-unix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'tauri-cli': 'patch:bug'
'@tauri-apps/cli': patch:bug
---

Strip Windows-only extensions from the binary path so an Android project initialized on Windows can be used on UNIX systems.
6 changes: 6 additions & 0 deletions .changes/fix-android-build-nvm4w-windows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'tauri-cli': 'patch:bug'
'@tauri-apps/cli': patch:bug
---

Enhance Android build script usage on Windows by attempting to run cmd, bat and exe formats.
11 changes: 10 additions & 1 deletion crates/tauri-cli/src/mobile/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,16 @@ pub fn exec(
build_args.push(target.command_name());
build_args.push(target.ide_build_script_name());

map.insert("tauri-binary", binary.to_string_lossy());
let mut binary = binary.to_string_lossy().to_string();
if binary.ends_with(".exe") || binary.ends_with(".cmd") || binary.ends_with(".bat") {
// remove Windows-only extension
binary.pop();
binary.pop();
binary.pop();
binary.pop();
}

map.insert("tauri-binary", binary);
map.insert("tauri-binary-args", &build_args);
map.insert("tauri-binary-args-str", build_args.join(" "));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,23 @@ open class BuildTask : DefaultTask() {
runTauriCli(executable)
} catch (e: Exception) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
runTauriCli("$executable.cmd")
// Try different Windows-specific extensions
val fallbacks = listOf(
"$executable.exe",
"$executable.cmd",
"$executable.bat",
)

var lastException: Exception = e
for (fallback in fallbacks) {
try {
runTauriCli(fallback)
return
} catch (fallbackException: Exception) {
lastException = fallbackException
}
}
throw lastException
} else {
throw e;
}
Expand Down