diff --git a/bin/jsindex b/bin/jsindex index 8208ea3..c52e823 100755 --- a/bin/jsindex +++ b/bin/jsindex @@ -51,15 +51,15 @@ if (empty($src)) { $indexer = new \cebe\jssearch\Indexer(); -$files = []; foreach($src as $dir) { - $files = array_merge($files, findFiles($dir)); + echo "Processing $dir\n"; + $files = findFiles($dir); if (empty($files)) { - error("No files where found in $dir."); + echo "No files where found in $dir.\n"; + } else { + $indexer->indexFiles($files, $dir); } - - $indexer->indexFiles($files, $dir); } $js = $indexer->exportJs(); @@ -119,15 +119,15 @@ function findFiles($dir, $ext = '.html') continue; } $path = $dir . DIRECTORY_SEPARATOR . $file; - if (substr($file, -($l = strlen($ext)), $l) === $ext) { - if (is_file($path)) { + if (is_file($path)) { + if (substr($file, -($l = strlen($ext)), $l) === $ext) { $list[] = $path; - } else { - $list = array_merge($list, findFiles($path, $ext)); } + } else { + $list = array_merge($list, findFiles($path, $ext)); } } closedir($handle); return $list; -} \ No newline at end of file +}