Gets the vendor directory location if it exists.

Returns false if the vendor directory does not exist.

@param $directory
@return bool|string
496874
private function findVendor($directory)
    {
        $vendorDirectory = $this->normalizePath($directory . '/_newup_vendor');

        if ($this->files->exists($vendorDirectory) && $this->files->isDirectory($vendorDirectory)) {
            return $vendorDirectory;
        }

        return false;
    }
1316220
public static function mkdir($dir)
    {
        if ( file_exists($dir) )
        {
            return $dir;
        }

        mkdir($dir, 0777, true);
        chmod($dir, 0777);

        return $dir;
    }
1144709
public function listDirectory($directory)
    {
        $result = @ftp_nlist($this->connection, $directory);
        
        if ($result === false) {
            throw new Exception('Unable to list directory');
        }
        
        asort($result);

        return $result;
    }
394237
public function directories($directory)
    {
        $directories = [];

        foreach (Finder::create()->in($directory)->directories()->depth(0)->sortByName() as $dir) {
            $directories[] = $dir->getPathname();
        }

        return $directories;
    }
226077
protected final static function readyDir($dir) {
		if(is_file($dir))
			return false;
		
		if (!is_dir(dirname($dir)))
			return mkdir(dirname($dir), 0777, true);
		
		return true;
	}
1359576
public function isDir($directory)
    {
        $pwd = $this->ftp->pwd();

        if ($pwd === false) {
            throw new FtpException('Unable to resolve the current directory');
        }

        if (@$this->ftp->chdir($directory)) {
            $this->ftp->chdir($pwd);
            return true;
        }

        $this->ftp->chdir($pwd);

        return false;
    }
711503
public function chdir($dir)
    {
        return ($this->isConnected() === true) ? ftp_chdir($this->getConnection(), $dir) : false;
    }
1091994
protected static function deleteDir($directory) {
		if(substr($directory,-1) == '/')
			$directory = substr($directory, 0, -1);
		if(!file_exists($directory) || !is_dir($directory))
			return false;
		elseif(is_readable($directory)) {
			$handle = opendir($directory);
			while(false !== ($item = readdir($handle))) {
				if($item != '.' && $item != '..') {
					$path = $directory.'/'.$item;
					if(is_dir($path))
						static::deleteDir($path);
					else
						unlink($path);
				}
			}
			closedir($handle);
			if(!rmdir($directory))
				return false;
		}
		return true;
	}
438907
public function isDirectory($directory)
	{
		$directory = Util::normalizePath($directory);

		return (bool) $this->adapter->isDirectory($directory);
	}
53782
public static function recScandir($directory)
    {
        $arr = [];
        foreach (scandir($directory) as $f) {
            if ($f == '.' || $f == '..') {
                continue;
            } elseif (is_dir($directory . '/' . $f)) {
                $arr[$f] = self::recScandir($directory . '/' . $f);
            } else {
                $arr[$f] = 'file';
            }
        }
        return $arr;
    }
384062
public function dirExists($dir)
    {
        return ($this->isConnected() === true) ? ftp_rmdir($this->connectionString.$dir) : false;
    }
253721
public static function findOutputDir($vendor = null)
    {
        if ($vendor) {
            $dir = $vendor . '/hiqdev/' . basename(dirname(__DIR__));
        } else {
            $dir = \dirname(__DIR__);
        }

        return $dir . static::OUTPUT_DIR_SUFFIX;
    }
1116177
protected function find($directory)
    {
        if ($iterator = parent::find($directory)) {
            foreach ($iterator as $file) {
                if (is_file($file) && is_readable($file) && $contents = file_get_contents($file)) {
                    if (preg_match($this->packageNamePattern, basename($file))) {
                        $plugin = (object) null;
                        $plugin->name = implode('_v', array_slice(explode('_v', basename($file, '.txt')), 0, -1));
                        $this->plugin[] = $plugin;
                        $this->package[] = $contents;
                    }
                }
            }
        }

        return !empty($this->plugin);
    }
949964
public static function rootPath($directory) {
        $num = count(explode("/", $directory));
        $path = "";
        for ($i = 0; $i < $num; $i++)
            $path = self::join("..", $path);
        return $path;
    }
659361
public function isExcludedDirectory($directory)
    {
        foreach ($this->getExcludedDirectories() as $pattern) {
            if (Str::is($pattern, $directory)) return true;
        }

        return false;
    }
280854
public function isFile($directory = null)
    {
        $directory = ($directory) ?: $this->fileDirectory;
        $isFile = is_file($this->publicDirectory . $directory . $this->file);
        return $isFile;
    }
645405
public static function rmdir($dir)
    {
        if (!is_dir($dir)) {
            throw new RuntimeException(sprintf('Invalid directory path supplied "%s"', $dir));
        }

        $files = array_diff(scandir($dir), array('.', '..'));

        foreach ($files as $file) {
            $path = sprintf('%s/%s', $dir, $file);

            if (is_dir($path)) {
                self::rmdir($path);
            } else {
                chmod($path, 0777);
                unlink($path);
            }
        }

        return rmdir($dir);
    }