added module options
This commit is contained in:
28
patch-lib.py
Normal file
28
patch-lib.py
Normal file
@@ -0,0 +1,28 @@
|
||||
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")
|
||||
Reference in New Issue
Block a user