From a4b71a1992ee287171b69b36962a5d35695c2cfc Mon Sep 17 00:00:00 2001 From: Tony <68118705+Legend-Master@users.noreply.github.com> Date: Sun, 10 Aug 2025 18:52:54 +0800 Subject: [PATCH] refactor(opener): rename to FailedToConvertPathToItemIdList (#2906) --- plugins/opener/src/error.rs | 5 +++-- plugins/opener/src/reveal_item_in_dir.rs | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/opener/src/error.rs b/plugins/opener/src/error.rs index 36d781b44..c5a4dde3c 100644 --- a/plugins/opener/src/error.rs +++ b/plugins/opener/src/error.rs @@ -31,8 +31,9 @@ pub enum Error { Win32Error(#[from] windows::core::Error), #[error("Path doesn't have a parent: {0}")] NoParent(PathBuf), - #[error("Path is invalid: {0}")] - InvalidPath(PathBuf), + #[cfg(windows)] + #[error("Failed to convert path '{0}' to ITEMIDLIST")] + FailedToConvertPathToItemIdList(PathBuf), #[error("Failed to convert path to file:// url")] FailedToConvertPathToFileUrl, #[error(transparent)] diff --git a/plugins/opener/src/reveal_item_in_dir.rs b/plugins/opener/src/reveal_item_in_dir.rs index 1cea2641d..6112fb8b1 100644 --- a/plugins/opener/src/reveal_item_in_dir.rs +++ b/plugins/opener/src/reveal_item_in_dir.rs @@ -169,7 +169,9 @@ mod imp { let path_hstring = HSTRING::from(path); let item_id_list = unsafe { ILCreateFromPathW(&path_hstring) }; if item_id_list.is_null() { - Err(crate::Error::InvalidPath(path.to_owned())) + Err(crate::Error::FailedToConvertPathToItemIdList( + path.to_owned(), + )) } else { Ok(Self { hstring: path_hstring,