Create path for file.

@param Filesystem $filesystem
@param string     $type       File type.

@return string
185617
protected function createPath(Filesystem $filesystem, $type)
    {
        $customPath = $this->option('path');

        $defaultPath = config("vue-generators.paths.{$type}s");

        $path = $customPath !== null ? $customPath : $defaultPath;

        $this->buildPathFromArray($path, $filesystem);

        return $path;
    }
169591
public function handle(Filesystem $filesystem)
    {
        $this->filesystem = $filesystem;

        $this->extensionDir = config('admin.extension_dir');

        InputExtensionDir:
        if (empty($this->extensionDir)) {
            $this->extensionDir = $this->ask('Please input a directory to store your extension:');
        }

        if (!file_exists($this->extensionDir)) {
            $this->makeDir();
        }

        $this->package = $this->argument('extension');

        InputExtensionName:
        if (!$this->validateExtensionName($this->package)) {
            $this->package = $this->ask("[$this->package] is not a valid package name, please input a name like (<vendor>/<name>)");
            goto InputExtensionName;
        }

        $this->makeDirs();
        $this->makeFiles();

        $this->info("The extension scaffolding generated successfully. \r\n");
        $this->showTree();
    }
836771
public function getFilesystem($filesystemName)
    {
        if (!array_key_exists($filesystemName, $this->filesystemMap)) {
            throw new NoSuchFilesystemException($filesystemName);
        }

        return $this->filesystemMap[$filesystemName];
    }
1213988
protected function publishing(Filesystem $filesystem, $force = false)
    {
        parent::publishing($filesystem, $force);

        if ($this->option('routes') || $this->confirm('Do you wish to append routes? [y|N]')) {
            $this->publishRoute($filesystem, $this->getRoutesFile());
        }
    }
743182
function DirPath($type, $path = '')
    {

        if (!empty($path))
        {
            $path = explode('[\\/]', str_replace($this->dir[$type], '', realpath($path)));
            $path = array_filter($path);
        }

        $ret = '<div class="addrItem" path="" pathtype="' . $type . '" title=""><img src="img/' . ($type == 'images' ? 'folder_open_image' : 'folder_open_document') . '.png" width="16" height="16" alt="Корневая директория" /></div>';
        $i = 0;
        $addPath = '';
        if (is_array($path))
        {
            foreach ($path as $v)
            {
                $i++;
                $addPath .= '/' . $v;
                if (sizeof($path) == $i)
                {
                    $ret .= '<div class="addrItemEnd" path="' . $addPath . '" pathtype="' . $type . '" title=""><div>' . $v . '</div></div>';
                }
                else
                {
                    $ret .= '<div class="addrItem" path="' . $addPath . '" pathtype="' . $type . '" title=""><div>' . $v . '</div></div>';
                }
            }
        }


        return $ret;
    }
360473
public function dir(string $type, string $append = ''): string
    {
        return $this->_dir($type, $append);
    }
1363967
public static function create(string $path, string $type):int
    {
        try {
            switch ($type) {
                case "directory":
                    if (!is_dir($path)) {
                        mkdir($path);
                    }
                    break;
                case "file":
                    if (!is_file($path)) {
                        touch($path);
                    }
                    break;
            }
        } catch (\Exception $exception) {
            throw new \Exception("Server Error : Cannot create $type element => ".$exception);
        }

        return (1);
    }
1148970
protected function createFilepath(string $folder, string $filename): string
    {
        $separator = '';
        if (!\in_array($folder[-1], ['/', '\\'], true)) {
            $separator = \DIRECTORY_SEPARATOR;
        }

        return $folder . $separator . $filename;
    }
375102
public function asPreview($encFileName, Filesystem $fileSystem)
    {
        try {
            return Cache::remember($encFileName.'_preview', 3600, function () use ($encFileName, $fileSystem) {
                $fileName = CryptoServiceFacade::url_decode($encFileName);

                if (config('cms.storage-location') === 'local' || config('cms.storage-location') === null) {
                    $filePath = storage_path('app/'.$fileName);
                    $contentType = $fileSystem->mimeType($filePath);
                    $ext = strtoupper($fileSystem->extension($filePath));
                } else {
                    $filePath = Storage::disk(config('cms.storage-location', 'local'))->url($fileName);
                    $fileTool = new SplFileInfo($filePath);
                    $ext = $fileTool->getExtension();
                    $contentType = $this->getMimeType($ext);
                }

                if (stristr($contentType, 'image')) {
                    $headers = ['Content-Type' => $contentType];
                    $fileContent = $this->getFileContent($fileName, $contentType, $ext);
                } else {
                    $fileContent = file_get_contents($this->generateImage($ext));
                }

                return Response::make($fileContent, 200, [
                    'Content-Type' => $contentType,
                    'Content-Disposition' => 'attachment; filename="'.$fileName.'"',
                ]);
            });
        } catch (Exception $e) {
            return Response::make('file not found');
        }
    }
839014
public static function findTemplate (\Twig_Loader_Filesystem $filesystem, $name)
    {
        $name = self::normalizeName($name);
        self::validateName($name);
        list($namespace, $shortname) = self::parseName($name);
        $paths = $filesystem->getPaths($namespace);
        if (empty($paths)) {
            throw new Twig_Error_Loader(sprintf('There are no registered paths for namespace "%s".', $namespace));
        }
        foreach ($paths as $path) {
            if (is_file($path . '/' . $shortname)) {
                if (false !== $realpath = realpath($path . '/' . $shortname)) {
                    return $realpath;
                }
                return $path . '/' . $shortname;
            }
        }
        throw new Twig_Error_Loader(sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $paths)));
    }
315629
public static function createDate(String $file, String $type = 'd.m.Y G:i:s') : String
    {
        $file = self::rpath($file);

        if( ! file_exists($file) )
        {
            throw new Exception\FileNotFoundException(NULL, $file);
        }

        $date = filectime($file);

        return date($type, $date);
    }
1299813
public static function make(string $path, FormatInterface $format): Directory
    {
        return new static(new Filesystem(new Local($path)), '', $format);
    }
835678
protected static function _getFiles(&$config, $type, $silent = false) {
		$typeNS = $config ["mvcNS"] [$type];
		$typeDir = \ROOT . \DS . str_replace ( "\\", \DS, $typeNS );
		if (! $silent)
			echo \ucfirst ( $type ) . " directory is " . \ROOT . $typeNS . "\n";
		return UFileSystem::glob_recursive ( $typeDir . \DS . '*' );
	}
133418
public function fs()
    {
        if (null === $this->fs)
            $this->fs = new Filesystem($this->getFilesystemPath(), $this->adapter);
        return $this->fs;
    }
1356017
protected function createParentDirectory(Filesystem $filesystem, $directory)
    {
        if (! $filesystem->isDirectory($directory)) {
            $filesystem->makeDirectory($directory, 0755, true);
        }
    }
912957
protected function checkFile($path, $type, $file)
    {
        $filePath = implode('/', [$path, $type, $file]);

        if (is_file($filePath)) {
            return $filePath;
        } else {
            return false;
        }
    }
762782
public static function create($path = null, $mode = self::DEFAULT_UNIX_CHMOD_DIRECTORIES, $recursive = true)
    {
        if (is_null($path)) {
            return null;
        }
        return mkdir($path, Filesystem::getOctal($mode), $recursive);
    }