diff --git a/src-tauri/src/cmds.rs b/src-tauri/src/cmds.rs index 9e9749f..33de5e6 100644 --- a/src-tauri/src/cmds.rs +++ b/src-tauri/src/cmds.rs @@ -202,6 +202,13 @@ pub fn open_app_dir() -> CmdResult<()> { wrap_err!(open::that(app_dir)) } +#[tauri::command] +pub fn open_core_dir() -> CmdResult<()> { + let core_dir = wrap_err!(tauri::utils::platform::current_exe())?; + let core_dir = core_dir.parent().ok_or(format!("failed to get core dir"))?; + wrap_err!(open::that(core_dir)) +} + #[tauri::command] pub fn open_logs_dir() -> CmdResult<()> { let log_dir = wrap_err!(dirs::app_logs_dir())?; diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index abe0e7d..a3ff866 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -33,6 +33,7 @@ fn main() -> std::io::Result<()> { cmds::open_app_dir, cmds::open_logs_dir, cmds::open_web_url, + cmds::open_core_dir, // cmds::kill_sidecar, cmds::restart_sidecar, // clash diff --git a/src/components/setting/setting-verge.tsx b/src/components/setting/setting-verge.tsx index 7cf8313..ed43fa5 100644 --- a/src/components/setting/setting-verge.tsx +++ b/src/components/setting/setting-verge.tsx @@ -7,7 +7,7 @@ import { Switch, Typography, } from "@mui/material"; -import { openAppDir, openLogsDir, patchVergeConfig } from "@/services/cmds"; +import { openAppDir, openCoreDir, openLogsDir } from "@/services/cmds"; import { ArrowForward } from "@mui/icons-material"; import { useVerge } from "@/hooks/use-verge"; import { version } from "@root/package.json"; @@ -94,7 +94,7 @@ const SettingVerge = ({ onError }: Props) => { onCatch={onError} onFormat={onSwitchFormat} onChange={(e) => onChangeData({ traffic_graph: e })} - onGuard={(e) => patchVergeConfig({ traffic_graph: e })} + onGuard={(e) => patchVerge({ traffic_graph: e })} > @@ -155,6 +155,17 @@ const SettingVerge = ({ onError }: Props) => { + + + + + + ("open_core_dir").catch((err) => + Notice.error(err?.message || err.toString(), 1500) + ); +} + export async function openLogsDir() { return invoke("open_logs_dir").catch((err) => Notice.error(err?.message || err.toString(), 1500)