You are here

function imce_check_directory in IMCE 6.2

Same name and namespace in other branches
  1. 6 inc/page.inc \imce_check_directory()
  2. 7 inc/imce.page.inc \imce_check_directory()

Create a writable directory(any level) under file system directory.

1 call to imce_check_directory()
imce_working_directory in inc/imce.page.inc
Return an available directory for the profile.

File

inc/imce.page.inc, line 883
Implements the file browser.

Code

function imce_check_directory($dirname, $imce = array()) {
  if (!imce_reg_dir($dirname)) {
    return imce_inaccessible_directory($dirname, $imce);
  }
  $root = file_directory_path();
  $dirpath = $root . '/' . $dirname;
  if (!file_check_directory($dirpath)) {

    //directory does not exist. try to create it.
    $path = $root;
    foreach (explode('/', $dirname) as $arg) {
      $path .= '/' . $arg;
      if (!file_check_directory($path, FILE_CREATE_DIRECTORY)) {
        return imce_inaccessible_directory($dirname, $imce);
      }
    }
  }
  return TRUE;
}