aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/downloader/gzip_downloader.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-17 02:53:53 +0900
committernsfisis <nsfisis@gmail.com>2026-05-17 02:53:53 +0900
commita1c7e6908a26e10f6e1f23a51721664b5e2d838d (patch)
treec575c76f1b43359ed74913da4c6a2636643f1ba0 /crates/shirabe/src/downloader/gzip_downloader.rs
parent7f606f36fef0c0467c3c0db3d0da33af486dae8a (diff)
downloadphp-shirabe-a1c7e6908a26e10f6e1f23a51721664b5e2d838d.tar.gz
php-shirabe-a1c7e6908a26e10f6e1f23a51721664b5e2d838d.tar.zst
php-shirabe-a1c7e6908a26e10f6e1f23a51721664b5e2d838d.zip
chore(style): cargo fmt
Diffstat (limited to 'crates/shirabe/src/downloader/gzip_downloader.rs')
-rw-r--r--crates/shirabe/src/downloader/gzip_downloader.rs29
1 files changed, 19 insertions, 10 deletions
diff --git a/crates/shirabe/src/downloader/gzip_downloader.rs b/crates/shirabe/src/downloader/gzip_downloader.rs
index 2158126..81fdbed 100644
--- a/crates/shirabe/src/downloader/gzip_downloader.rs
+++ b/crates/shirabe/src/downloader/gzip_downloader.rs
@@ -1,25 +1,31 @@
//! ref: composer/src/Composer/Downloader/GzipDownloader.php
+use crate::downloader::archive_downloader::ArchiveDownloader;
+use crate::package::package_interface::PackageInterface;
+use crate::util::platform::Platform;
use anyhow::Result;
use shirabe_external_packages::react::promise::promise_interface::PromiseInterface;
use shirabe_php_shim::{
- RuntimeException,
- extension_loaded, fclose, fopen, fwrite, gzclose, gzopen, gzread,
- implode, parse_url, pathinfo, strtr,
- DIRECTORY_SEPARATOR, PATHINFO_FILENAME, PHP_URL_PATH,
+ DIRECTORY_SEPARATOR, PATHINFO_FILENAME, PHP_URL_PATH, RuntimeException, extension_loaded,
+ fclose, fopen, fwrite, gzclose, gzopen, gzread, implode, parse_url, pathinfo, strtr,
};
-use crate::downloader::archive_downloader::ArchiveDownloader;
-use crate::package::package_interface::PackageInterface;
-use crate::util::platform::Platform;
pub struct GzipDownloader {
inner: ArchiveDownloader,
}
impl GzipDownloader {
- pub(crate) fn extract(&self, package: &dyn PackageInterface, file: &str, path: &str) -> Result<Box<dyn PromiseInterface>> {
+ pub(crate) fn extract(
+ &self,
+ package: &dyn PackageInterface,
+ file: &str,
+ path: &str,
+ ) -> Result<Box<dyn PromiseInterface>> {
let filename = pathinfo(
- parse_url(&strtr(&package.get_dist_url().unwrap_or_default(), "\\", "/"), PHP_URL_PATH),
+ parse_url(
+ &strtr(&package.get_dist_url().unwrap_or_default(), "\\", "/"),
+ PHP_URL_PATH,
+ ),
PATHINFO_FILENAME,
);
let target_filepath = format!("{}{}{}", path, DIRECTORY_SEPARATOR, filename);
@@ -47,7 +53,10 @@ impl GzipDownloader {
implode(" ", &command),
self.inner.process.get_error_output(),
);
- return Err(anyhow::anyhow!(RuntimeException { message: process_error, code: 0 }));
+ return Err(anyhow::anyhow!(RuntimeException {
+ message: process_error,
+ code: 0
+ }));
}
self.extract_using_ext(file, &target_filepath);