Syntax fixes

This commit is contained in:
Connor Yoh 2025-07-17 15:19:40 +01:00
parent 8c9ef73b55
commit 57ccafaf93
2 changed files with 6 additions and 5 deletions

View File

@ -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));

View File

@ -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());