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/repository/path_repository.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/shirabe/src/repository/path_repository.rs') diff --git a/crates/shirabe/src/repository/path_repository.rs b/crates/shirabe/src/repository/path_repository.rs index 46b7f95f..13c512aa 100644 --- a/crates/shirabe/src/repository/path_repository.rs +++ b/crates/shirabe/src/repository/path_repository.rs @@ -25,8 +25,8 @@ use crate::util::Url; use indexmap::IndexMap; use shirabe_external_packages::composer::pcre::Preg; use shirabe_php_shim::{ - DIRECTORY_SEPARATOR, GLOB_BRACE, GLOB_MARK, GLOB_ONLYDIR, PhpMixed, RuntimeException, defined, - file_exists, file_get_contents, glob_with_flags, hash, php_regex, realpath, serialize, + GLOB_BRACE, GLOB_MARK, GLOB_ONLYDIR, PhpMixed, RuntimeException, defined, file_exists, + file_get_contents, glob_with_flags, hash, php_regex, realpath, serialize, }; #[derive(Debug)] @@ -378,7 +378,7 @@ impl PathRepository { Ok(glob_with_flags(&self.url, flags) .into_iter() .map(|val| { - val.replace(DIRECTORY_SEPARATOR, "/") + val.replace(std::path::MAIN_SEPARATOR, "/") .trim_end_matches('/') .to_string() }) -- cgit v1.3.1-4-g156e