diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index de612d0e..8e5a6a78 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -138,17 +138,19 @@ checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" [[package]] name = "applications" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3854b0be0ff49d616ac728fef23f743a17c0dc304cfd061e28021eb1ea220af" +checksum = "1963e89abe1c21616d3988dcd1c2c540a81768ccdcd0bdb1683ece5e09e78945" dependencies = [ "anyhow", "cocoa 0.25.0", "core-foundation 0.9.4", + "env_logger 0.10.2", "glob", "image", "ini", "lnk", + "log", "objc", "parselnk", "plist", @@ -736,7 +738,7 @@ dependencies = [ "async-trait", "base64 0.13.1", "dirs 5.0.1", - "env_logger", + "env_logger 0.11.7", "futures", "futures-util", "fuzzy_prefix_search", @@ -1478,6 +1480,19 @@ dependencies = [ "regex", ] +[[package]] +name = "env_logger" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" +dependencies = [ + "humantime", + "is-terminal", + "log", + "regex", + "termcolor", +] + [[package]] name = "env_logger" version = "0.11.7" @@ -2306,6 +2321,12 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" +[[package]] +name = "hermit-abi" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbd780fe5cc30f81464441920d82ac8740e2e46b29a6fad543ddd075229ce37e" + [[package]] name = "hex" version = "0.4.3" @@ -2411,6 +2432,12 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +[[package]] +name = "humantime" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b112acc8b3adf4b107a8ec20977da0273a8c386765a3ec0229bd500a1443f9f" + [[package]] name = "hyper" version = "0.14.32" @@ -2809,6 +2836,17 @@ dependencies = [ "once_cell", ] +[[package]] +name = "is-terminal" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" +dependencies = [ + "hermit-abi 0.5.0", + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "is-wsl" version = "0.4.0" @@ -4275,7 +4313,7 @@ checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" dependencies = [ "cfg-if", "concurrent-queue", - "hermit-abi", + "hermit-abi 0.4.0", "pin-project-lite", "rustix 0.38.44", "tracing", @@ -6267,6 +6305,15 @@ dependencies = [ "utf-8", ] +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + [[package]] name = "thin-slice" version = "0.1.1" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 4a4bd29f..b3e3c7fa 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -41,7 +41,7 @@ tauri-plugin-drag = "2" tauri-plugin-macos-permissions = "2" tauri-plugin-fs-pro = "2" tauri-plugin-screenshots = "2" -applications = "0.3.0" +applications = "0.3.1" tokio-native-tls = "0.3" # For wss connections tokio = { version = "1", features = ["full"] } diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 05b80b45..4b537acf 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -131,7 +131,8 @@ pub fn run() { server::attachment::upload_attachment, server::attachment::get_attachment, server::attachment::delete_attachment, - server::transcription::transcription + server::transcription::transcription, + local::application::get_default_search_paths ]) .setup(|app| { let registry = SearchSourceRegistry::default(); @@ -411,4 +412,4 @@ async fn get_app_search_source(app_handle: AppHandle) -> Result<( #[tauri::command] async fn show_settings(app_handle: AppHandle) { open_settings(&app_handle); -} +} \ No newline at end of file diff --git a/src-tauri/src/local/application.rs b/src-tauri/src/local/application.rs index 403b8f17..6afee538 100644 --- a/src-tauri/src/local/application.rs +++ b/src-tauri/src/local/application.rs @@ -12,6 +12,23 @@ use std::path::{Path, PathBuf}; use tauri::{AppHandle, Runtime}; use tauri_plugin_fs_pro::{icon, name}; +#[tauri::command] +pub fn get_default_search_paths(app_handle: AppHandle) -> Vec { + let paths = applications::get_default_search_paths(); + let ret = Vec::with_capacity(paths.len()); + for search_path in paths { + let path = search_path.path; + let path_string = path + .into_os_string() + .into_string() + .expect("path should be UTF-8 encoded"); + + ret.push(path_string); + } + + ret +} + pub struct ApplicationSearchSource { base_score: f64, icons: HashMap,