From dfb5900835f1780713d6766d3ee636950c8a7dd1 Mon Sep 17 00:00:00 2001 From: Curtis Mattoon Date: Tue, 22 Apr 2014 19:44:37 -0400 Subject: [PATCH] Update pico.php Added ignore for tmp file extensions in the get_files() method. When editing plugins with emacs, the get_files() method also grabs the temp files, which leads to a "Can't redclare class [PluginName]" error. Side note: Would these arrays be better in a property (ala DRY)? --- lib/pico.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/pico.php b/lib/pico.php index 07a1481..502d201 100644 --- a/lib/pico.php +++ b/lib/pico.php @@ -327,6 +327,9 @@ class Pico { $array_items = array(); if($handle = opendir($directory)){ while(false !== ($file = readdir($handle))){ + if(in_array(substr($file, -1), array('~', '#'))){ + continue; + } if(preg_match("/^(^\.)/", $file) === 0){ if(is_dir($directory. "/" . $file)){ $array_items = array_merge($array_items, $this->get_files($directory. "/" . $file, $ext));