diff options
Diffstat (limited to 'crates/shirabe/src/downloader/archive_downloader.rs')
| -rw-r--r-- | crates/shirabe/src/downloader/archive_downloader.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/crates/shirabe/src/downloader/archive_downloader.rs b/crates/shirabe/src/downloader/archive_downloader.rs index 6ddf29b6..d2ee4a75 100644 --- a/crates/shirabe/src/downloader/archive_downloader.rs +++ b/crates/shirabe/src/downloader/archive_downloader.rs @@ -9,6 +9,7 @@ use crate::util::Filesystem; use crate::util::Platform; use indexmap::IndexMap; use shirabe_external_packages::symfony::finder::Finder; +use shirabe_php_shim::Catch as _; use shirabe_php_shim::{ DIRECTORY_SEPARATOR, PhpMixed, RuntimeException, bin2hex, file_exists, is_dir, random_bytes, realpath, @@ -155,7 +156,7 @@ pub trait ArchiveDownloader { Ok(false) => {} Err(e) => { // ignore error, and simply do not renameAsOne - if e.downcast_ref::<RuntimeException>().is_none() { + if !e.is_instanceof::<RuntimeException>() { return Err(e); } } @@ -273,14 +274,11 @@ fn rename_recursively( ); if is_dir(&target) { if !is_dir(file) { - return Err(RuntimeException { - message: format!( - "Installing {} would lead to overwriting the {} directory with a file from the package, invalid operation.", - package, - target.display() - ), - code: 0, - } + return Err(RuntimeException::new(format!( + "Installing {} would lead to overwriting the {} directory with a file from the package, invalid operation.", + package, + target.display() + )) .into()); } rename_recursively(filesystem, package.clone(), file, &target)?; |
