From 880a5eaad9dcdfd31563385f11ba1f63d38cfd14 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 9 Aug 2026 06:19:30 +0900 Subject: 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) --- crates/shirabe/src/downloader/gzip_downloader.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'crates/shirabe/src/downloader/gzip_downloader.rs') diff --git a/crates/shirabe/src/downloader/gzip_downloader.rs b/crates/shirabe/src/downloader/gzip_downloader.rs index 9473deff..3ddca2a4 100644 --- a/crates/shirabe/src/downloader/gzip_downloader.rs +++ b/crates/shirabe/src/downloader/gzip_downloader.rs @@ -14,9 +14,8 @@ use crate::util::Platform; use crate::util::ProcessExecutor; use indexmap::IndexMap; use shirabe_php_shim::{ - DIRECTORY_SEPARATOR, PATHINFO_FILENAME, PHP_URL_PATH, PhpMixed, RuntimeException, - extension_loaded, fclose, fopen, fwrite, gzclose, gzopen, gzread, impl_php_class, implode, - parse_url, pathinfo, strtr, + PATHINFO_FILENAME, PHP_URL_PATH, PhpMixed, RuntimeException, extension_loaded, fclose, fopen, + fwrite, gzclose, gzopen, gzread, impl_php_class, implode, parse_url, pathinfo, strtr, }; #[derive(Debug)] @@ -91,7 +90,7 @@ impl ArchiveDownloader for GzipDownloader { .unwrap_or(""), PATHINFO_FILENAME, ); - let target_filepath = format!("{}{}{}", path, DIRECTORY_SEPARATOR, filename); + let target_filepath = format!("{}{}{}", path, std::path::MAIN_SEPARATOR, filename); if !Platform::is_windows() { let command = vec![ -- cgit v1.3.1-4-g156e