diff options
-rw-r--r-- | system/helpers/file_helper.php | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index 7eb93dab2..e1a4ff31a 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -168,17 +168,16 @@ if (! function_exists('get_filenames')) function get_filenames($source_dir, $include_path = FALSE, $_recursion = FALSE)
{
static $_filedata = array();
-
- // reset the array and make sure $source_dir has a trailing slash on the initial call
- if ($_recursion === FALSE)
- {
- $_filedata = array();
- $source_dir = realpath($source_dir).'/';
- }
-
-
+
if ($fp = @opendir($source_dir))
{
+ // reset the array and make sure $source_dir has a trailing slash on the initial call
+ if ($_recursion === FALSE)
+ {
+ $_filedata = array();
+ $source_dir = realpath($source_dir).'/';
+ }
+
while (FALSE !== ($file = readdir($fp)))
{
if (@is_dir($source_dir.$file) && substr($file, 0, 1) != '.')
|