If $path exists return $path else make it.

@param $subdir - subdirectory
@return full path if is a success or false
174509
public function setFilePath($subdir)
    {
        $path = $this->getFilePath($subdir, '', true);
        if(is_dir($path))
            return $path;
        elseif(mkdir($path, 0777)) {
            foreach($this->owner->sizes as $size) {
                if($size['catalog']) {
                    if(mkdir($path . $size['catalog'], 0777))
                        continue;
                    else
                        return false;
                } else
                    continue;
            }
            return $path;
        } else
            return false;
    }
204717
public function makeDirectory($path)
    {
        $this->fs[$path] = $this->newDir();
        $this->fs[$path]->setPath($path);
        return $this->fs[$path];
    }
1154006
public function exists($path)
    {
        if ('.' === $path || empty($path)) {
            $path = $this->localPath;
        } else {
            $path = "{$this->localPath}/{$path}";
        }

        return $this->filesystem->has($path);
    }
361205
private function createSubfolder($path, array $params)
    {
        // Ensure the path ends in "/" and the body is empty.
        $params['Key'] = rtrim($params['Key'], '/') . '/';
        $params['Body'] = '';

        // Fail if this pseudo directory key already exists
        if ($this->getClient()->doesObjectExist(
            $params['Bucket'],
            $params['Key'])
        ) {
            return $this->triggerError("Subfolder already exists: {$path}");
        }

        return $this->boolCall(function () use ($params, $path) {
            $this->getClient()->putObject($params);
            $this->clearCacheKey($path);
            return true;
        });
    }
377427
protected function makeDirectory($path): string
    {
        if (! $this->files->isDirectory($path)) {
            $this->files->makeDirectory($path, 0777, true, true);
        }

        return $path;
    }
647592
public static function GetDirContent($path)
    {
        $files = array();
        $directory = opendir($path);

        while(($file = readdir($directory)) !== false)
        {
            $full_path = $path . "/" . $file;

            if(is_file($full_path))
            {
                $files[] = $full_path;
            }
            elseif($file != "." && $file != ".." && is_dir($full_path))
            {
                $files[] = $full_path;
                $files = array_merge($files, self::GetDirContent($full_path));
            }
        }

        closedir($directory);

        return $files;
    }
1257302
public static function getAllFiles($dir, $subdir = false) {
        $path = '';
        $stack[] = $dir;
        while ($stack) {
            $thisdir = array_pop($stack);
            if ($dircont = scandir($thisdir)) {
                $i = 0;
                while (isset($dircont[$i])) {
                    if ($dircont[$i] !== '.' && $dircont[$i] !== '..') {
                        $current_file = "{$thisdir}/{$dircont[$i]}";
                        if (is_file($current_file)) {
                            $path[] = "{$thisdir}/{$dircont[$i]}";
                        } elseif (is_dir($current_file)) {
                            $path[] = "{$thisdir}/{$dircont[$i]}/";

                            if ($subdir === true)
                                $stack[] = $current_file;
                        }
                    }
                    $i++;
                }
            }
        }
        return $path;
    }
803270
protected function getExistsPath($path)
    {
        $fullPath = $this->concatPaths($path);

        if (!file_exists($fullPath)) {
            $fullPath = $this->getExistsPath(pathinfo($fullPath, PATHINFO_DIRNAME));
        }

        return $fullPath;
    }
1071572
public function getDir($subDir, $psrDir = false)
    {
        $subDir = $psrDir === true ? prepare_class_name($subDir) : $subDir;
        $subDir = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $subDir);

        if (is_dir($dirPath = $this->getRealPath() . $subDir)) {
            return $dirPath . DIRECTORY_SEPARATOR;
        }

        return false;
    }
875502
public static function mkdir($path, $mode = 0755, $recursive = false, $force = false)
    {
        if (!self::exists($path)) {
            if ($force) {
                return @mkdir($path, $mode, $recursive);
            }

            return mkdir($path, $mode, $recursive);
        }

        return true;
    }
495990
protected function makePath($path)
    {
        // Log
        $this->info("Attempting to make path: {$path}");

        // Make
        if (!is_dir($path)) {
            if (mkdir($path) === false) {
                $this->error("Error in making path: {$path}");
                return false;
            }
        }

        // Make writable
        if (!is_writable($path)) {
            if (chmod($path, 0777) === false) {
                $this->error("Error in making path writable: {$path}");
                return false;
            }
        }

        return true;
    }
180127
public function makeDirectory($path)
    {
        if ($this->files->isDirectory($path) === false) {
            $this->files->makeDirectory($path, 0777, true, true);
        }

        return $this;
    }
862739
public static function folder($path, $relative = false)
		{
		    $path = Paths::make($path, $relative);
		    return rtrim($path, '/') . '/';
		}
170991
public function getDirectory($path)
    {
        $subDirectory = new self($this->getFileSystemId(), $this->getFullPath($path));
        $subDirectory->setServiceLocator($this->getServiceLocator());
        return $subDirectory;
    }
1199295
private function getFilePath(InputInterface $input, $subDir)
    {
        $path = [];

        $path[] = $this->getContainer()->getParameter('sculpin.source_dir');
        $path[] = $subDir;
        $path[] = $input->getOption('filename');

        return implode(DIRECTORY_SEPARATOR, array_filter($path));
    }
1167482
public function force($path, $mode = 0777, $recursive = true)
    {
        if ($this->exists($path)) {
            return true;
        }

        return $this->makeDirectory($path, $mode, $recursive);
    }
578870
public static function find($fileName = false, $path = false) {

        if($fileName) {

            if(!$path) {

                $path = __DIR__;
            }

            if(self::isFolder($path)) {

                $dir = new \RecursiveDirectoryIterator($path);
                foreach (new \RecursiveIteratorIterator($dir) as $filePath) {
                    
                    if($fileName == basename($filePath)) {

                        return $filePath;
                    }
                }
            }
        }

        return false;
    }