diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/file.inc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/includes/file.inc b/includes/file.inc index 26227d529..b1b488d76 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -887,9 +887,11 @@ function file_scan_directory($dir, $mask, $nomask = array('.', '..', 'CVS'), $ca while ($file = readdir($handle)) { if (!in_array($file, $nomask) && $file[0] != '.') { if (is_dir("$dir/$file") && $recurse) { - $files = array_merge($files, file_scan_directory("$dir/$file", $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth + 1)); + // Give priority to files in this folder by merging them in after any subdirectory files. + $files = array_merge(file_scan_directory("$dir/$file", $mask, $nomask, $callback, $recurse, $key, $min_depth, $depth + 1), $files); } elseif ($depth >= $min_depth && ereg($mask, $file)) { + // Always use this match over anything already set in $files with the same $$key. $filename = "$dir/$file"; $basename = basename($file); $name = substr($basename, 0, strrpos($basename, '.')); |