mirror of https://github.com/ospab/ostp.git
fix(gui): add dev/build npm scripts that auto-build helper, fix find_helper_exe
This commit is contained in:
parent
b0491e14e3
commit
a398bf2fdd
|
|
@ -4,7 +4,9 @@
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"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": {
|
"devDependencies": {
|
||||||
"@tauri-apps/cli": "^2"
|
"@tauri-apps/cli": "^2"
|
||||||
|
|
|
||||||
|
|
@ -438,16 +438,10 @@ struct HelperPipeState {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_helper_exe() -> Option<PathBuf> {
|
fn find_helper_exe() -> Option<PathBuf> {
|
||||||
// First look next to current exe
|
// The helper is always built to the same target dir as the GUI exe.
|
||||||
if let Ok(exe) = std::env::current_exe() {
|
// In dev mode: target/debug/ostp-tun-helper.exe (same dir as ostp-gui.exe)
|
||||||
if let Some(dir) = exe.parent() {
|
// In release: target/release/ostp-tun-helper.exe (same dir as ostp-gui.exe)
|
||||||
let candidate = dir.join("ostp-tun-helper.exe");
|
// In installed build: next to ostp-gui.exe
|
||||||
if candidate.exists() {
|
|
||||||
return Some(candidate);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Dev: look in target/debug next to workspace root
|
|
||||||
if let Ok(exe) = std::env::current_exe() {
|
if let Ok(exe) = std::env::current_exe() {
|
||||||
if let Some(dir) = exe.parent() {
|
if let Some(dir) = exe.parent() {
|
||||||
let candidate = dir.join("ostp-tun-helper.exe");
|
let candidate = dir.join("ostp-tun-helper.exe");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue