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/archive_downloader.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'crates/shirabe/src/downloader/archive_downloader.rs') diff --git a/crates/shirabe/src/downloader/archive_downloader.rs b/crates/shirabe/src/downloader/archive_downloader.rs index d2ee4a75..097fc1af 100644 --- a/crates/shirabe/src/downloader/archive_downloader.rs +++ b/crates/shirabe/src/downloader/archive_downloader.rs @@ -11,8 +11,7 @@ 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, + PhpMixed, RuntimeException, bin2hex, file_exists, is_dir, random_bytes, realpath, }; use std::path::{Path, PathBuf}; @@ -92,13 +91,11 @@ pub trait ArchiveDownloader { .filesystem .borrow() .normalize_path(&vendor_dir) - .contains( - &self - .inner() - .filesystem - .borrow() - .normalize_path(&format!("{}{}", path, DIRECTORY_SEPARATOR)), - ) + .contains(&self.inner().filesystem.borrow().normalize_path(&format!( + "{}{}", + path, + std::path::MAIN_SEPARATOR + ))) { self.inner() .filesystem -- cgit v1.3.1-4-g156e