aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src')
-rw-r--r--crates/shirabe/src/downloader/file_downloader.rs18
-rw-r--r--crates/shirabe/src/downloader/gzip_downloader.rs11
-rw-r--r--crates/shirabe/src/factory.rs11
3 files changed, 12 insertions, 28 deletions
diff --git a/crates/shirabe/src/downloader/file_downloader.rs b/crates/shirabe/src/downloader/file_downloader.rs
index c5dfc5f7..4ee580f8 100644
--- a/crates/shirabe/src/downloader/file_downloader.rs
+++ b/crates/shirabe/src/downloader/file_downloader.rs
@@ -712,20 +712,14 @@ impl FileDownloader {
impl FileDownloader {
fn get_dist_path(&self, package: PackageInterfaceHandle, component: i64) -> String {
pathinfo(
- PhpMixed::String(
- parse_url(
- &strtr(&package.get_dist_url().unwrap_or_default(), "\\", "/"),
- PHP_URL_PATH,
- )
- .as_string()
- .unwrap_or("")
- .to_string(),
- ),
+ parse_url(
+ &strtr(&package.get_dist_url().unwrap_or_default(), "\\", "/"),
+ PHP_URL_PATH,
+ )
+ .as_string()
+ .unwrap_or(""),
component,
)
- .as_string()
- .unwrap_or("")
- .to_string()
}
pub(crate) fn clear_last_cache_write(&self, package: PackageInterfaceHandle) {
diff --git a/crates/shirabe/src/downloader/gzip_downloader.rs b/crates/shirabe/src/downloader/gzip_downloader.rs
index 70b9f7bb..297cbc11 100644
--- a/crates/shirabe/src/downloader/gzip_downloader.rs
+++ b/crates/shirabe/src/downloader/gzip_downloader.rs
@@ -84,15 +84,12 @@ impl ArchiveDownloader for GzipDownloader {
parse_url(
&strtr(&package.get_dist_url().unwrap_or_default(), "\\", "/"),
PHP_URL_PATH,
- ),
+ )
+ .as_string()
+ .unwrap_or(""),
PATHINFO_FILENAME,
);
- let target_filepath = format!(
- "{}{}{}",
- path,
- DIRECTORY_SEPARATOR,
- filename.as_string().unwrap_or_default()
- );
+ let target_filepath = format!("{}{}{}", path, DIRECTORY_SEPARATOR, filename);
if !Platform::is_windows() {
let command = vec![
diff --git a/crates/shirabe/src/factory.rs b/crates/shirabe/src/factory.rs
index de632143..7328bf42 100644
--- a/crates/shirabe/src/factory.rs
+++ b/crates/shirabe/src/factory.rs
@@ -375,15 +375,8 @@ impl Factory {
}
pub fn get_lock_file(composer_file: &str) -> String {
- let ext = pathinfo(
- PhpMixed::String(composer_file.to_string()),
- PATHINFO_EXTENSION,
- );
- let is_json = match ext {
- PhpMixed::String(s) => s == "json",
- _ => false,
- };
- if is_json {
+ let ext = pathinfo(composer_file, PATHINFO_EXTENSION);
+ if ext == "json" {
format!(
"{}lock",
substr(composer_file, 0, Some(composer_file.len() as i64 - 4))