diff --git a/package.json b/package.json index 53ccfee..8c2ad76 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "quicklook", - "version": "0.8.1", + "version": "0.8.2", "description": "Windows 平台的文件预览工具", "private": true, "type": "module", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 4d0428e..2105a6f 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -121,7 +121,7 @@ checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "app" -version = "0.8.1" +version = "0.8.2" dependencies = [ "calamine", "chrono", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 53d0d5e..2477467 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "app" -version = "0.8.1" +version = "0.8.2" description = "Windows 平台的文件预览工具" authors = ["GuoJikun "] license = "" diff --git a/src-tauri/src/preview.rs b/src-tauri/src/preview.rs index f8a7037..06a3d33 100644 --- a/src-tauri/src/preview.rs +++ b/src-tauri/src/preview.rs @@ -1,6 +1,5 @@ use std::sync::mpsc; use std::thread; -use log::kv::ToValue; use tauri::{ webview::PageLoadEvent, AppHandle, Error as TauriError, Manager, WebviewUrl, WebviewWindowBuilder }; @@ -12,14 +11,14 @@ use windows::{ Com::{ CoCreateInstance, CoInitializeEx, CoUninitialize, IDispatch, IServiceProvider, CLSCTX_INPROC_SERVER, CLSCTX_LOCAL_SERVER, COINIT_APARTMENTTHREADED }, - SystemServices::{SFGAO_BROWSABLE, SFGAO_FILESYSTEM, SFGAO_FOLDER, SFGAO_STORAGE}, + SystemServices::SFGAO_FILESYSTEM, Variant::{self} }, UI::{ Accessibility::{CUIAutomation, IUIAutomation, IUIAutomationSelectionPattern, UIA_NamePropertyId, UIA_SelectionPatternId}, Input::KeyboardAndMouse, Shell::{ - FOLDERID_Documents, FOLDERID_Downloads, FOLDERID_Libraries, FOLDERID_Music, FOLDERID_Pictures, FOLDERID_Videos, IShellBrowser, IShellItem, IShellItemArray, IShellView, IShellWindows, SHCreateItemFromParsingName, SHGetKnownFolderPath, ShellWindows, KF_FLAG_DEFAULT, SIGDN_DESKTOPABSOLUTEPARSING, SIGDN_FILESYSPATH, SIGDN_NORMALDISPLAY, SVGIO_SELECTION, SWC_DESKTOP, SWFO_NEEDDISPATCH + FOLDERID_Desktop, FOLDERID_Documents, FOLDERID_Downloads, FOLDERID_Libraries, FOLDERID_Music, FOLDERID_Pictures, FOLDERID_Videos, IShellBrowser, IShellItem, IShellItemArray, IShellView, IShellWindows, SHCreateItemFromParsingName, SHGetKnownFolderPath, ShellWindows, KF_FLAG_DEFAULT, SIGDN_DESKTOPABSOLUTEPARSING, SIGDN_FILESYSPATH, SVGIO_SELECTION, SWC_DESKTOP, SWFO_NEEDDISPATCH }, WindowsAndMessaging }, @@ -186,8 +185,8 @@ impl Selected { let phwnd = shell_browser.GetWindow().unwrap(); let top = WindowsAndMessaging::GetAncestor(phwnd, WindowsAndMessaging::GA_ROOT); - if hwnd_gfw.0 != top.0 { - log::info!("top hwnd 不相等"); + if !hwnd_gfw.eq(&top) { + log::info!("fwhwnd: {:?}, top: {:?} 不相等", hwnd_gfw, top); return Ok(target_path); } @@ -279,7 +278,7 @@ impl Selected { } let breadcrumb_hwnd = breadcrumb_hwnd.unwrap(); let mut breadcrumb_title = win::get_window_text(breadcrumb_hwnd); - println!("breadcrumb_title: {:?}", breadcrumb_title); + log::info!("弹窗目录: {:?}", breadcrumb_title); let arr = breadcrumb_title.split(": ").map(|item|item.to_string()).collect::>(); if arr.len() > 1 { breadcrumb_title = arr[1].clone(); @@ -287,7 +286,7 @@ impl Selected { if !breadcrumb_title.contains(":\\") { let path = Self::get_library_path(&breadcrumb_title); - println!("path: {:?}", path); + log::error!("path: {:?}", path); if path.is_err() { return Ok(target_path); } @@ -303,12 +302,12 @@ impl Selected { unsafe { // 1. 获取库文件夹路径 let folder_id = match name { - "下载" => &FOLDERID_Downloads, - "音乐" => &FOLDERID_Music, - "图片" => &FOLDERID_Pictures, - "文档" => &FOLDERID_Documents, - "视频" => &FOLDERID_Videos, - "桌面" => &FOLDERID_Libraries, + "下载" | "Downloads" => &FOLDERID_Downloads, + "音乐" | "Music" => &FOLDERID_Music, + "图片" | "Pictures" => &FOLDERID_Pictures, + "文档" | "Documents" => &FOLDERID_Documents, + "视频" | "Videos" => &FOLDERID_Videos, + "桌面" | "Desktop" => &FOLDERID_Desktop, _ => { // 如果是自定义库,尝试从Libraries文件夹读取 let libraries_path = SHGetKnownFolderPath( diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 60859e9..c81ce56 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "productName": "quicklook", - "version": "0.8.1", + "version": "0.8.2", "identifier": "dev.jikun.quicklook", "build": { "frontendDist": "../dist",