From 06b6353e8b016f2830d99f1586becf08810f8403 Mon Sep 17 00:00:00 2001 From: Daniel Lowrey Date: Sat, 18 Jul 2015 15:29:18 -0400 Subject: [PATCH] eio isfile update --- lib/EioDescriptor.php | 4 ++-- lib/EioFilesystem.php | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/EioDescriptor.php b/lib/EioDescriptor.php index 4d124e6..6eb8cd2 100644 --- a/lib/EioDescriptor.php +++ b/lib/EioDescriptor.php @@ -121,8 +121,8 @@ class EioDescriptor implements Descriptor { \eio_get_last_error($req) )); } else { - $stat["isdir"] = (bool) ($stat["mode"] & Filesystem::S_IFDIR); - $stat["isfile"] = (bool) ($stat["mode"] & Filesystem::S_IFREG); + $stat["isfile"] = (bool) ($stat["mode"] & \EIO_S_IFREG); + $stat["isdir"] = empty($stat["isfile"]); } \call_user_func($this->decrement); $promisor->succeed($result); diff --git a/lib/EioFilesystem.php b/lib/EioFilesystem.php index cef8faf..9d4f46a 100644 --- a/lib/EioFilesystem.php +++ b/lib/EioFilesystem.php @@ -9,9 +9,6 @@ use Amp\Failure; use Amp\Deferred; class EioFilesystem implements Filesystem { - const S_IFDIR = 0x4000; - const S_IFREG = 0x8000; - private $reactor; private $stream; private $watcher; @@ -114,8 +111,8 @@ class EioFilesystem implements Filesystem { $stat = null; } else { $stat = $result; - $stat["isdir"] = (bool) ($stat["mode"] & self::S_IFDIR); - $stat["isfile"] = (bool) ($stat["mode"] & self::S_IFREG); + $stat["isfile"] = (bool) ($stat["mode"] & \EIO_S_IFREG); + $stat["isdir"] = empty($stat["isfile"]); } $this->decrementPending(); $promisor->succeed($stat);