fix: reparar build do desktop tauri

This commit is contained in:
Esdras Renan 2025-10-10 22:28:35 -03:00
parent e291770417
commit c463530757
9 changed files with 263 additions and 49 deletions

View file

@ -0,0 +1,38 @@
import { spawn } from "node:child_process"
import { fileURLToPath } from "node:url"
import { dirname, resolve } from "node:path"
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
const pathKey = process.platform === "win32" ? "Path" : "PATH"
const currentPath = process.env[pathKey] ?? process.env[pathKey.toUpperCase()] ?? ""
const separator = process.platform === "win32" ? ";" : ":"
const stubDir = resolve(__dirname)
process.env[pathKey] = [stubDir, currentPath].filter(Boolean).join(separator)
if (pathKey !== "PATH") {
process.env.PATH = process.env[pathKey]
}
if (!process.env.TAURI_BUNDLE_TARGETS) {
if (process.platform === "linux") {
process.env.TAURI_BUNDLE_TARGETS = "deb rpm"
} else if (process.platform === "win32") {
process.env.TAURI_BUNDLE_TARGETS = "nsis"
}
}
const executable = process.platform === "win32" ? "tauri.cmd" : "tauri"
const child = spawn(executable, process.argv.slice(2), {
stdio: "inherit",
shell: false,
})
child.on("exit", (code, signal) => {
if (signal) {
process.kill(process.pid, signal)
} else {
process.exit(code ?? 0)
}
})

9
apps/desktop/scripts/xdg-open Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Minimal stub to satisfy tools that expect xdg-open during bundling.
# Fails silently when the real binary is unavailable.
if command -v xdg-open >/dev/null 2>&1; then
exec xdg-open "$@"
else
exit 0
fi