aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/downloader/zip_downloader.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-09 06:19:30 +0900
committernsfisis <nsfisis@gmail.com>2026-08-09 06:19:30 +0900
commit880a5eaad9dcdfd31563385f11ba1f63d38cfd14 (patch)
tree6f9de7b2b8331628a74287112711f65ae3eddc52 /crates/shirabe/src/downloader/zip_downloader.rs
parentf3d60c7836da0d50d59a22cfd6e4692e3dc75581 (diff)
downloadphp-shirabe-880a5eaad9dcdfd31563385f11ba1f63d38cfd14.tar.gz
php-shirabe-880a5eaad9dcdfd31563385f11ba1f63d38cfd14.tar.zst
php-shirabe-880a5eaad9dcdfd31563385f11ba1f63d38cfd14.zip
refactor(php-shim): use std::path::MAIN_SEPARATOR over a shim constant
The shim's DIRECTORY_SEPARATOR was hardcoded to "/", so every ported `'\\' === DIRECTORY_SEPARATOR` check compared against a constant that does not track the target platform. std::path::MAIN_SEPARATOR and MAIN_SEPARATOR_STR carry the same meaning as PHP's constant and resolve per platform, so the Windows branches are selected on Windows targets. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/downloader/zip_downloader.rs')
-rw-r--r--crates/shirabe/src/downloader/zip_downloader.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/shirabe/src/downloader/zip_downloader.rs b/crates/shirabe/src/downloader/zip_downloader.rs
index c481f13f..bc565ea0 100644
--- a/crates/shirabe/src/downloader/zip_downloader.rs
+++ b/crates/shirabe/src/downloader/zip_downloader.rs
@@ -12,10 +12,10 @@ use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
use shirabe_external_packages::symfony::process::ExecutableFinder;
use shirabe_php_shim::Catch as _;
use shirabe_php_shim::{
- CmpOp, DIRECTORY_SEPARATOR, ErrorException, PhpMixed, RuntimeException,
- UnexpectedValueException, ZipArchive, bin2hex, class_exists, file_exists, file_get_contents,
- filesize, function_exists, hash_file, impl_php_class, is_file, json_encode, php_regex,
- random_int, str_contains, str_replace, strlen, substr, version_compare,
+ CmpOp, ErrorException, PhpMixed, RuntimeException, UnexpectedValueException, ZipArchive,
+ bin2hex, class_exists, file_exists, file_get_contents, filesize, function_exists, hash_file,
+ impl_php_class, is_file, json_encode, php_regex, random_int, str_contains, str_replace, strlen,
+ substr, version_compare,
};
use std::sync::Mutex;
@@ -84,8 +84,8 @@ impl ZipDownloader {
let map: IndexMap<&str, String> = [
// normalize separators to backslashes to avoid problems with 7-zip on windows
// see https://github.com/composer/composer/issues/10058
- ("%file%", file.replace('/', DIRECTORY_SEPARATOR)),
- ("%path%", path.replace('/', DIRECTORY_SEPARATOR)),
+ ("%file%", file.replace('/', std::path::MAIN_SEPARATOR_STR)),
+ ("%path%", path.replace('/', std::path::MAIN_SEPARATOR_STR)),
]
.into_iter()
.collect();