aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-php-shim
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-08-06 04:00:20 +0900
committernsfisis <nsfisis@gmail.com>2026-08-06 04:00:20 +0900
commit9a6881276a6aeb4d3b49046045f6e26303cc6e52 (patch)
treebcc585bf358ae9daf9a8ec0eee1e07b98935e6e6 /crates/shirabe-php-shim
parent92d2199afcecd0056e82d2559700769715401ef0 (diff)
downloadphp-shirabe-9a6881276a6aeb4d3b49046045f6e26303cc6e52.tar.gz
php-shirabe-9a6881276a6aeb4d3b49046045f6e26303cc6e52.tar.zst
php-shirabe-9a6881276a6aeb4d3b49046045f6e26303cc6e52.zip
fix(symfony-filesystem): restore upstream behavior in five spots
Port the Symfony Filesystem branches this file had left out: * copy() preserves the origin mtime via touch() * exists() rejects paths longer than PHP_MAXPATHLEN - 2, so its return type becomes anyhow::Result<bool> * doRemove()'s symlink branch keeps the DIRECTORY_SEPARATOR disjunct, which stops it from throwing on Unix where upstream never does * symlink() normalizes separators and mirrors instead of linking when copyOnWindows is set * mirror() skips entries whose real path is the target directory or was already created earlier in the same call PHP_MAXPATHLEN is new in shirabe-php-shim. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe-php-shim')
-rw-r--r--crates/shirabe-php-shim/src/fs.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/shirabe-php-shim/src/fs.rs b/crates/shirabe-php-shim/src/fs.rs
index 9303ad21..ac7a4f99 100644
--- a/crates/shirabe-php-shim/src/fs.rs
+++ b/crates/shirabe-php-shim/src/fs.rs
@@ -22,6 +22,15 @@ pub const PATHINFO_BASENAME: i64 = 2;
pub const PATH_SEPARATOR: &str = ":";
pub const DIRECTORY_SEPARATOR: &str = "/";
+/// PHP `PHP_MAXPATHLEN`: the platform's `MAXPATHLEN` (`MAX_PATH` on Windows).
+pub const PHP_MAXPATHLEN: i64 = if cfg!(windows) {
+ 260
+} else if cfg!(target_os = "linux") {
+ 4096
+} else {
+ 1024
+};
+
pub const FILE_IGNORE_NEW_LINES: i64 = 2;
pub const SEEK_SET: i64 = 0;