You are here

function imce_get_directory in IMCE 5

return working image directory.

1 call to imce_get_directory()
imce_settings_user in ./imce.module
get current user's settings

File

./imce.module, line 429

Code

function imce_get_directory($set) {
  if ($set['shared']) {

    //use shared folder if it is declared
    $dir = file_directory_path() . ($set['shared'] == '/' ? '' : '/' . $set['shared']);
  }
  else {

    //use personal folders by default.
    $dir = file_directory_path() . '/' . $set['prefix'] . $set['uid'];
  }
  if (file_check_directory($dir, TRUE)) {
    if ($set['subnav'] && $set['subdirs']) {
      foreach (explode(',', $set['subdirs']) as $sub) {
        $sub = $dir . '/' . trim($sub, '\\/ ');
        file_check_directory($sub, TRUE);
      }
    }
    return $dir;
  }
  exit(t('Directory error!') . ' - ' . $dir . theme('status_messages'));

  //without a working directory imce is useless. so, terminate.
}