From bea34c42613c10a12b9bd65318de0a799c2db030 Mon Sep 17 00:00:00 2001 From: Paul Arthur Date: Thu, 18 Oct 2012 17:48:14 -0400 Subject: Fix spurious errors from Catalog::create() is_readable is flaky under Windows, opendir should be more accurate. --- lib/class/catalog.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib/class/catalog.class.php') diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index 4dc46c53..9057547b 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -275,9 +275,13 @@ class Catalog extends database_object { $path = Dba::escape($data['path']); // Make sure the path is readable/exists - if (!is_readable($data['path']) AND $data['type'] == 'local') { - Error::add('general', sprintf(T_('Error: %s is not readable or does not exist'), scrub_out($data['path']))); - return false; + if ($data['type'] == 'local') { + $handle = opendir($path); + if ($handle === false) { + Error::add('general', sprintf(T_('Error: %s is not readable or does not exist'), scrub_out($data['path']))); + return false; + } + closedir($handle); } // Make sure this path isn't already in use by an existing catalog -- cgit