Added more logging

This commit is contained in:
Connor Yoh 2025-07-15 18:00:33 +01:00
parent 30b8fa0f36
commit 4d05a1be41
2 changed files with 20 additions and 3 deletions

View File

@ -1,4 +1,4 @@
use tauri::{RunEvent, WindowEvent};
use tauri::{RunEvent, WindowEvent, Manager};
mod utils;
mod commands;
@ -47,7 +47,25 @@ pub fn run() {
cleanup_backend();
// Allow the window to close
}
_ => {}
// Handle file open events (macOS specific)
#[cfg(target_os = "macos")]
RunEvent::OpenUrl { url } => {
add_log(format!("🔍 DEBUG: OpenUrl event received: {}", url));
// Handle URL-based file opening
if url.starts_with("file://") {
let file_path = url.strip_prefix("file://").unwrap_or(&url);
if file_path.ends_with(".pdf") {
add_log(format!("📂 File opened via URL event: {}", file_path));
set_opened_file(file_path.to_string());
// Emit event to frontend
app_handle.emit_all("file-opened", file_path).unwrap();
}
}
}
_ => {
add_log(format!("🔍 DEBUG: Unhandled event: {:?}", event));
}
}
});
}

View File

@ -19,7 +19,6 @@
"fullscreen": false
}
]
},
"bundle": {
"active": true,