diff options
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/shirabe-php-shim/src/fs.rs | 17 | ||||
| -rw-r--r-- | crates/shirabe/src/util/filesystem.rs | 3 |
2 files changed, 1 insertions, 19 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), diff --git a/crates/shirabe/src/util/filesystem.rs b/crates/shirabe/src/util/filesystem.rs index 6cb33385..066b1981 100644 --- a/crates/shirabe/src/util/filesystem.rs +++ b/crates/shirabe/src/util/filesystem.rs @@ -841,8 +841,7 @@ impl Filesystem { } if is_dir(path) { - return Silencer::call(|| Ok(shirabe_php_shim::opendir(path).is_some())) - .unwrap_or(false); + return Silencer::call(|| Ok(std::fs::read_dir(path).is_ok())).unwrap_or(false); } // assume false otherwise |
