From 822a943606773647058e5dbb334e52e61c71e6d8 Mon Sep 17 00:00:00 2001 From: Nixevol Date: Sun, 25 Oct 2026 07:00:54 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=87=E4=BB=B6=E5=A4=B9=E6=8C=89?= =?UTF-8?q?=E9=92=AE=E6=94=B9=E4=B8=BA=E5=9C=A8=E8=B5=84=E6=BA=90=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=99=A8=E4=B8=AD=E5=AE=9A=E4=BD=8D=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- desktop/src/features/download/DownloadManagerView.vue | 8 +++----- desktop/src/shared/http.ts | 7 +++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/desktop/src/features/download/DownloadManagerView.vue b/desktop/src/features/download/DownloadManagerView.vue index eeb22cf..75cf6e0 100644 --- a/desktop/src/features/download/DownloadManagerView.vue +++ b/desktop/src/features/download/DownloadManagerView.vue @@ -2,7 +2,7 @@ import { computed, onMounted, onUnmounted, ref } from "vue"; import { NButton, NEmpty, NIcon, NInputNumber, NProgress, NTag, NTooltip, useMessage } from "naive-ui"; import { ChevronBackOutline, FolderOpenOutline, HelpCircleOutline, PauseOutline, PlayOutline, StopCircleOutline } from "@vicons/ionicons5"; -import { ApiError, openLocal } from "../../shared/http"; +import { ApiError, openLocal, revealLocal } from "../../shared/http"; import { cancelJob, loadDownloadSettings, loadJobs, pauseJob, resumeJob, saveDownloadSettings, type DownloadJob } from "./api"; const props = defineProps<{ focusId: string }>(); @@ -157,10 +157,8 @@ async function openFile(job: DownloadJob) { } async function openDir(job: DownloadJob) { - const index = Math.max(job.csvPath.lastIndexOf("\\"), job.csvPath.lastIndexOf("/")); - const folder = index > 0 ? job.csvPath.slice(0, index) : job.csvPath; - const opened = await openLocal(folder).catch(() => false); - if (!opened) message.info(folder); + const revealed = await revealLocal(job.csvPath).catch(() => false); + if (!revealed) message.info(job.csvPath); } diff --git a/desktop/src/shared/http.ts b/desktop/src/shared/http.ts index d734f2d..f721bba 100644 --- a/desktop/src/shared/http.ts +++ b/desktop/src/shared/http.ts @@ -104,6 +104,13 @@ export async function openLocal(path: string) { return true; } +export async function revealLocal(path: string) { + if (!("__TAURI_INTERNALS__" in window)) return false; + const { revealItemInDir } = await import("@tauri-apps/plugin-opener"); + await revealItemInDir(path); + return true; +} + export async function chooseDirectory() { if (!("__TAURI_INTERNALS__" in window)) return null; const { open } = await import("@tauri-apps/plugin-dialog");