import sys target = '.run(tauri::generate_context!())' replacement = '''.setup(|app| { if let Ok(server_url) = std::env::var("PINEPODS_SERVER") { if !server_url.is_empty() { use tauri::Manager; let window = app.get_webview_window("main").unwrap(); window.navigate(server_url.parse().unwrap()).unwrap(); } } Ok(()) }) .run(tauri::generate_context!())''' with open(sys.argv[1], 'r') as f: content = f.read() if target not in content: print(f"ERROR: Could not find target string in {sys.argv[1]}") sys.exit(1) content = content.replace(target, replacement) with open(sys.argv[1], 'w') as f: f.write(content) print("Successfully patched lib.rs")