Fix: withGlobalTauri + Bridge-Pfadsuche für Dev-Modus

- tauri.conf.json: withGlobalTauri: true — behebt 'invoke undefined'
- claude.rs: Bridge-Script in 3 Pfaden suchen (Binary-Dir, Cargo-Manifest, CWD)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Eddy 2026-04-13 20:43:01 +02:00
parent df3b33a6ed
commit 11ecbd83f3
2 changed files with 14 additions and 7 deletions

View file

@ -77,13 +77,19 @@ pub fn start_bridge(app: &AppHandle) -> Result<(), String> {
.ok_or("Kein Parent-Verzeichnis")?
.to_path_buf();
let script_path = exe_dir.join("scripts").join("claude-bridge.js");
let script_path = if script_path.exists() {
script_path
} else {
// Fallback für Entwicklung
std::path::PathBuf::from("scripts/claude-bridge.js")
};
// Script in mehreren Pfaden suchen
let candidates = vec![
exe_dir.join("scripts").join("claude-bridge.js"),
// Entwicklung: relativ zum Cargo-Manifest
std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../scripts/claude-bridge.js"),
// Fallback: CWD
std::env::current_dir().unwrap_or_default().join("scripts/claude-bridge.js"),
];
let script_path = candidates.iter()
.find(|p| p.exists())
.cloned()
.ok_or_else(|| format!("claude-bridge.js nicht gefunden. Gesucht in: {:?}", candidates))?;
println!("🔌 Starte Claude Bridge: {:?}", script_path);

View file

@ -24,6 +24,7 @@
"center": true
}
],
"withGlobalTauri": true,
"security": {
"csp": null
}