Exemplo n.º 1
0
 public function validateDirectory($path, $flags = self::MUST_EXIST)
 {
     $errorDetail = NULL;
     if (!empty($path)) {
         $dir = Dir::factoryTS($path);
         // workaround file
         if (self::RESOLVE_RELATIVE && !Dir::isAbsolutePath((string) $dir) && !$dir->isRelative()) {
             $dir = new Dir('.' . DIRECTORY_SEPARATOR . $dir);
         }
         $dir->resolvePath();
         if (!($flags & self::MUST_EXIST) || $dir->exists()) {
             return $dir;
         } else {
             $errorDetail = ' It must exist!';
         }
     }
     throw $this->exitException(sprintf("Directory from path: '%s' cannot be found.%s", $path, $errorDetail));
 }