protected function _globDir($aDir, RTArray &$results) { if (!is_dir($aDir)) { return; } $contents = scandir($aDir); $validator = FileNameValidator::alloc()->init(); $fullPathToNode = ""; foreach ($contents as $node) { $fullPathToNode = $aDir->stringByAppendingPathComponent(RTString::stringWithString($node)); // If the node represents a directory but does not start with a "." // character... if (is_dir($fullPathToNode) && strpos($node, ".") !== 0) { $arr = RTMutableArray::anArray(); $this->_globDir($fullPathToNode, $arr); $results->addObject(RTDictionary::dictionaryWithObject_forKey($arr, $node)); } else { if ($validator->isValidFileName($node) == YES) { try { // See if we can parse the plist file $dict = RTDictionary::dictionaryWithContentsOfFile(RTString::stringWithString($fullPathToNode)); // $node is a valid plist if ($dict->count() !== 0) { $results->addObject($node); } } catch (Exception $e) { // $node is not a valid plist $results->addObject("(PARSE_ERROR) " . $node); } } } } }
/** Returns the array of file extensions that are to be ignored during a directory scan. \returns RTArray */ public function excludeExtensions() { if (self::$_excludeExtensions == null) { self::$_excludeExtensions = Settings::sharedSettings()->objectForKey("exclude_extensions"); } return self::$_excludeExtensions; }