( executable, environment = process.env, platform = process.platform, )
| 22 | // Generated Xcode and Gradle steps invoke cargo-tauri through Cargo. Keep |
| 23 | // their child environment bound to the same verified executable as the caller. |
| 24 | export function tauriEnvironment( |
| 25 | executable, |
| 26 | environment = process.env, |
| 27 | platform = process.platform, |
| 28 | ) { |
| 29 | const windows = platform === "win32"; |
| 30 | const keys = Object.keys(environment).filter((key) => |
| 31 | windows ? key.toLowerCase() === "path" : key === "PATH", |
| 32 | ); |
| 33 | const key = keys[0] ?? (windows ? "Path" : "PATH"); |
| 34 | const result = { ...environment }; |
| 35 | for (const existing of keys) delete result[existing]; |
| 36 | const inherited = environment[key]; |
| 37 | result[key] = |
| 38 | (windows ? win32 : posix).dirname(executable) + |
| 39 | (inherited ? `${windows ? ";" : ":"}${inherited}` : ""); |
| 40 | return result; |
| 41 | } |
| 42 | // Keep argv structured even for synchronous package builders. The wrapper |
| 43 | // validates the host binary before delegating its original Tauri arguments. |
| 44 | export function tauriCommand(args) { |
no outgoing calls
no test coverage detected