fix(gui): add dev/build npm scripts that auto-build helper, fix find_helper_exe

This commit is contained in:
ospab 2026-05-15 23:12:22 +03:00
parent b0491e14e3
commit a398bf2fdd
2 changed files with 7 additions and 11 deletions

View File

@ -4,7 +4,9 @@
"version": "0.1.0",
"type": "module",
"scripts": {
"tauri": "tauri"
"tauri": "tauri",
"dev": "cargo build -p ostp-tun-helper && tauri dev",
"build": "cargo build -p ostp-tun-helper --release && tauri build"
},
"devDependencies": {
"@tauri-apps/cli": "^2"

View File

@ -438,16 +438,10 @@ struct HelperPipeState {
}
fn find_helper_exe() -> Option<PathBuf> {
// First look next to current exe
if let Ok(exe) = std::env::current_exe() {
if let Some(dir) = exe.parent() {
let candidate = dir.join("ostp-tun-helper.exe");
if candidate.exists() {
return Some(candidate);
}
}
}
// Dev: look in target/debug next to workspace root
// The helper is always built to the same target dir as the GUI exe.
// In dev mode: target/debug/ostp-tun-helper.exe (same dir as ostp-gui.exe)
// In release: target/release/ostp-tun-helper.exe (same dir as ostp-gui.exe)
// In installed build: next to ostp-gui.exe
if let Ok(exe) = std::env::current_exe() {
if let Some(dir) = exe.parent() {
let candidate = dir.join("ostp-tun-helper.exe");