From 6dd09abb33d86e1aa737667f9e15a18ed41d52e1 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 9 Aug 2026 06:25:03 +0900 Subject: refactor(external-packages): test for Windows with cfg!(windows) MAIN_SEPARATOR is the path separator; PHP's `'\\' === DIRECTORY_SEPARATOR` uses it as an OS test only because PHP has no dedicated one. cfg!(windows) says what the branch actually selects on, and leaves MAIN_SEPARATOR to the sites that really join or split paths. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe-external-packages/src/symfony/filesystem/filesystem.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/shirabe-external-packages/src/symfony/filesystem/filesystem.rs') diff --git a/crates/shirabe-external-packages/src/symfony/filesystem/filesystem.rs b/crates/shirabe-external-packages/src/symfony/filesystem/filesystem.rs index 0aba97fb..295a7b86 100644 --- a/crates/shirabe-external-packages/src/symfony/filesystem/filesystem.rs +++ b/crates/shirabe-external-packages/src/symfony/filesystem/filesystem.rs @@ -201,7 +201,7 @@ impl Filesystem { if shirabe_php_shim::is_link(&file) { // See https://bugs.php.net/52176 if !(shirabe_php_shim::unlink(&file) - || std::path::MAIN_SEPARATOR != '\\' + || !cfg!(windows) || shirabe_php_shim::rmdir(&file)) && shirabe_php_shim::file_exists(&file) { @@ -272,7 +272,7 @@ impl Filesystem { let mut origin_dir = origin_dir.to_string(); let mut target_dir = target_dir.to_string(); - if std::path::MAIN_SEPARATOR == '\\' { + if cfg!(windows) { origin_dir = shirabe_php_shim::strtr(&origin_dir, "/", "\\"); target_dir = shirabe_php_shim::strtr(&target_dir, "/", "\\"); -- cgit v1.3.1-4-g156e