diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-15 14:30:43 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-15 14:31:02 +0900 |
| commit | 2936cb809da433a92f267f3bc232d88ed4e315ac (patch) | |
| tree | e5f74f7ee4abb9ec3d01e143ca5cf51f03c6a2bf /crates/shirabe-php-shim | |
| parent | f1edda70e5eba2f7db36ea17bc7a4588bcd8d2fc (diff) | |
| download | php-shirabe-2936cb809da433a92f267f3bc232d88ed4e315ac.tar.gz php-shirabe-2936cb809da433a92f267f3bc232d88ed4e315ac.tar.zst php-shirabe-2936cb809da433a92f267f3bc232d88ed4e315ac.zip | |
refactor(php-shim): drop the unused opendir directory handle
PhpDirHandle recorded the opened path and nothing else, and its only
caller asked just whether the open had succeeded. A resource type that
has to gain readdir and closedir before it means anything is worse than
the std::fs::read_dir call it wraps, so Filesystem::isReadable now makes
that call directly.
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.rs | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/crates/shirabe-php-shim/src/fs.rs b/crates/shirabe-php-shim/src/fs.rs index 296f8f4a..1bb1379a 100644 --- a/crates/shirabe-php-shim/src/fs.rs +++ b/crates/shirabe-php-shim/src/fs.rs @@ -1056,23 +1056,6 @@ pub fn sys_get_temp_dir() -> String { std::env::temp_dir().to_string_lossy().into_owned() } -// A directory-handle resource. This is a distinct resource kind from the byte streams modeled by -// PhpResource; readdir/closedir have no callers yet, so it only records the opened path. -// TODO(php-semantics): give it real readdir/closedir behavior (cursor over the entries) when needed. -#[derive(Debug)] -pub struct PhpDirHandle { - pub path: std::path::PathBuf, -} - -pub fn opendir(path: impl AsRef<std::path::Path>) -> Option<PhpDirHandle> { - let path = path.as_ref(); - // opendir succeeds iff the path is a readable directory. - std::fs::read_dir(path).ok()?; - Some(PhpDirHandle { - path: path.to_path_buf(), - }) -} - pub fn pathinfo(path: &str, option: i64) -> String { match option { PATHINFO_DIRNAME => dirname(path), |
