Signed-off-by: quexeky <git@quexeky.dev>
This commit is contained in:
quexeky
2025-10-13 08:10:52 +11:00
parent 2859a59622
commit 3b09dcfb73
3 changed files with 11 additions and 2 deletions

View File

@ -116,7 +116,7 @@ platformInfo.value = currentPlatform;
async function openDataDir() {
if (!dataDir.value) return;
try {
await open(dataDir.value);
await invoke("open_fs", { path: dataDir.value });
} catch (error) {
console.error("Failed to open data dir:", error);
}
@ -126,7 +126,7 @@ async function openLogFile() {
if (!dataDir.value) return;
try {
const logPath = `${dataDir.value}/drop.log`;
await open(logPath);
await invoke("open_fs", { path: logPath });
} catch (error) {
console.error("Failed to open log file:", error);
}

View File

@ -5,6 +5,7 @@ use download_manager::DOWNLOAD_MANAGER;
use log::{debug, error};
use tauri::AppHandle;
use tauri_plugin_autostart::ManagerExt;
use tauri_plugin_opener::OpenerExt;
use crate::AppState;
@ -72,3 +73,10 @@ pub fn get_autostart_enabled(app: AppHandle) -> Result<bool, tauri_plugin_autost
Ok(db_state)
}
#[tauri::command]
pub fn open_fs(path: String, app_handle: AppHandle) -> Result<(), tauri_plugin_opener::Error> {
app_handle
.opener()
.open_path(path, None::<&str>)
}

View File

@ -229,6 +229,7 @@ pub fn run() {
fetch_state,
quit,
fetch_system_data,
open_fs,
// User utils
update_settings,
fetch_settings,