fix: build error in windows and linux

This commit is contained in:
2024-03-06 15:32:51 +07:00
parent 0e1e7524c9
commit 25d07303a3

View File

@@ -120,16 +120,20 @@ fn main() {
])
.build(tauri::generate_context!())
.expect("error while running tauri application")
.run(|app, event| {
if let tauri::RunEvent::Opened { urls } = event {
if let Some(w) = app.get_webview_window("main") {
let urls = urls
.iter()
.map(|u| u.as_str())
.collect::<Vec<_>>()
.join(",");
let _ = w.eval(&format!("window.onFileOpen(`{urls}`)"));
.run(
#[allow(unused_variables)]
|app, event| {
#[cfg(any(target_os = "macos"))]
if let tauri::RunEvent::Opened { urls } = event {
if let Some(w) = app.get_webview_window("main") {
let urls = urls
.iter()
.map(|u| u.as_str())
.collect::<Vec<_>>()
.join(",");
let _ = w.eval(&format!("window.onFileOpen(`{urls}`)"));
}
}
}
});
},
);
}