You are here

function coder_upgrade_scan_directory in Coder 7

Same name and namespace in other branches
  1. 7.2 coder_upgrade/coder_upgrade.inc \coder_upgrade_scan_directory()

Scans a directory and finds all first-level directories beneath it.

TODO Replace this with a call to file_scan_directory in include/files.inc.

Parameters

string $path Directory path.:

Return value

Array of directory names.

1 call to coder_upgrade_scan_directory()
coder_upgrade_directory_list in coder_upgrade/includes/conversion.inc
Returns list of directories in module input directory.

File

coder_upgrade/coder_upgrade.inc, line 49
Provides constants and utility functions.

Code

function coder_upgrade_scan_directory($path) {
  static $ignore = array(
    '.',
    '..',
    '.svn',
  );
  $dirs = array();
  $path = $path . '/';
  if (!is_dir($path)) {
    return $dirs;
  }
  $files = scandir($path);
  foreach ($files as $file) {
    $file_path = $path . $file;
    if (is_dir($file_path) && !in_array(basename($file_path), $ignore)) {
      $dirs[] = $file;
    }
  }
  return $dirs;
}