aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/downloader/path_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/path_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/path_downloader.rs')
-rw-r--r--crates/shirabe/src/downloader/path_downloader.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/shirabe/src/downloader/path_downloader.rs b/crates/shirabe/src/downloader/path_downloader.rs
index 9449e74a..4be835cd 100644
--- a/crates/shirabe/src/downloader/path_downloader.rs
+++ b/crates/shirabe/src/downloader/path_downloader.rs
@@ -23,8 +23,8 @@ use crate::util::ProcessExecutor;
use indexmap::IndexMap;
use shirabe_external_packages::symfony::filesystem::Filesystem as SymfonyFilesystem;
use shirabe_php_shim::{
- DIRECTORY_SEPARATOR, PHP_WINDOWS_VERSION_MAJOR, PHP_WINDOWS_VERSION_MINOR, PhpMixed,
- RuntimeException, file_exists, function_exists, impl_php_class, is_dir, realpath,
+ PHP_WINDOWS_VERSION_MAJOR, PHP_WINDOWS_VERSION_MINOR, PhpMixed, RuntimeException, file_exists,
+ function_exists, impl_php_class, is_dir, realpath,
};
#[derive(Debug)]
@@ -261,9 +261,9 @@ impl DownloaderInterface for PathDownloader {
if format!(
"{}{}",
realpath(&path).unwrap_or_default(),
- DIRECTORY_SEPARATOR
+ std::path::MAIN_SEPARATOR
)
- .starts_with(&format!("{}{}", real_url, DIRECTORY_SEPARATOR))
+ .starts_with(&format!("{}{}", real_url, std::path::MAIN_SEPARATOR))
{
// IMPORTANT NOTICE: If you wish to change this, don't. You are wasting your time and ours.
//
@@ -383,7 +383,7 @@ impl DownloaderInterface for PathDownloader {
format!(
"{}{}{}",
Platform::get_cwd(false)?,
- DIRECTORY_SEPARATOR,
+ std::path::MAIN_SEPARATOR,
path
)
} else {