From 57ccafaf932aaba44da93ef5c7ac91cac9f332b2 Mon Sep 17 00:00:00 2001 From: Connor Yoh Date: Thu, 17 Jul 2025 15:19:40 +0100 Subject: [PATCH] Syntax fixes --- frontend/src-tauri/src/file_handler.rs | 4 ++-- frontend/src-tauri/src/lib.rs | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend/src-tauri/src/file_handler.rs b/frontend/src-tauri/src/file_handler.rs index f01d34374..d432a8131 100644 --- a/frontend/src-tauri/src/file_handler.rs +++ b/frontend/src-tauri/src/file_handler.rs @@ -94,7 +94,7 @@ mod macos_native { add_log(format!("📂 Number of files to open: {}", count)); for i in 0..count { - let filename: id = msg_send![filenames, objectAtIndex:i]; + let filename: id = msg_send![filenames, objectAtIndex: i]; let cstr = { let bytes: *const std::os::raw::c_char = msg_send![filename, UTF8String]; std::ffi::CStr::from_ptr(bytes) @@ -134,7 +134,7 @@ mod macos_native { add_log("⚠️ Tauri already has an NSApplication delegate, trying to extend it...".to_string()); // Try to add our method to the existing delegate's class - let delegate_class = msg_send![existing_delegate, class]; + let delegate_class: id = msg_send![existing_delegate, class]; let class_name: *const std::os::raw::c_char = msg_send![delegate_class, name]; let class_name_str = std::ffi::CStr::from_ptr(class_name).to_string_lossy(); add_log(format!("🔍 Existing delegate class: {}", class_name_str)); diff --git a/frontend/src-tauri/src/lib.rs b/frontend/src-tauri/src/lib.rs index ec6896036..f64b8bd0b 100644 --- a/frontend/src-tauri/src/lib.rs +++ b/frontend/src-tauri/src/lib.rs @@ -1,4 +1,4 @@ -use tauri::{RunEvent, WindowEvent}; +use tauri::{RunEvent, WindowEvent, Emitter}; mod utils; mod commands; @@ -44,8 +44,9 @@ pub fn run() { RunEvent::Opened { urls } => { add_log(format!("📂 Tauri file opened event: {:?}", urls)); for url in urls { - if url.starts_with("file://") { - let file_path = url.strip_prefix("file://").unwrap_or(&url); + let url_str = url.as_str(); + if url_str.starts_with("file://") { + let file_path = url_str.strip_prefix("file://").unwrap_or(url_str); if file_path.ends_with(".pdf") { add_log(format!("📂 Processing opened PDF: {}", file_path)); set_opened_file(file_path.to_string());