refactor(opener): rename to FailedToConvertPathToItemIdList (#2906)

This commit is contained in:
Tony
2025-08-10 18:52:54 +08:00
committed by GitHub
parent 4eb36b0ff5
commit a4b71a1992
2 changed files with 6 additions and 3 deletions
+3 -2
View File
@@ -31,8 +31,9 @@ pub enum Error {
Win32Error(#[from] windows::core::Error), Win32Error(#[from] windows::core::Error),
#[error("Path doesn't have a parent: {0}")] #[error("Path doesn't have a parent: {0}")]
NoParent(PathBuf), NoParent(PathBuf),
#[error("Path is invalid: {0}")] #[cfg(windows)]
InvalidPath(PathBuf), #[error("Failed to convert path '{0}' to ITEMIDLIST")]
FailedToConvertPathToItemIdList(PathBuf),
#[error("Failed to convert path to file:// url")] #[error("Failed to convert path to file:// url")]
FailedToConvertPathToFileUrl, FailedToConvertPathToFileUrl,
#[error(transparent)] #[error(transparent)]
+3 -1
View File
@@ -169,7 +169,9 @@ mod imp {
let path_hstring = HSTRING::from(path); let path_hstring = HSTRING::from(path);
let item_id_list = unsafe { ILCreateFromPathW(&path_hstring) }; let item_id_list = unsafe { ILCreateFromPathW(&path_hstring) };
if item_id_list.is_null() { if item_id_list.is_null() {
Err(crate::Error::InvalidPath(path.to_owned())) Err(crate::Error::FailedToConvertPathToItemIdList(
path.to_owned(),
))
} else { } else {
Ok(Self { Ok(Self {
hstring: path_hstring, hstring: path_hstring,