Browscap\Generator\AbstractBuildGenerator::checkDirectoryExists PHP Method

checkDirectoryExists() protected method

protected checkDirectoryExists ( string $directory, string $type ) : string
$directory string
$type string
return string
    protected function checkDirectoryExists($directory, $type)
    {
        if (!isset($directory)) {
            throw new \Exception('You must specify a ' . $type . ' folder');
        }
        $realDirectory = realpath($directory);
        if ($realDirectory === false) {
            throw new \Exception('The directory "' . $directory . '" does not exist, or we cannot access it');
        }
        if (!is_dir($realDirectory)) {
            throw new \Exception('The path "' . $realDirectory . '" did not resolve to a directory');
        }
        return $realDirectory;
    }