Creates a path for a new GridFS file, which does not yet have an ID.

@return string
334347
private function createPathForUpload()
    {
        return sprintf(
            '%s://%s/%s.files',
            self::$streamWrapperProtocol,
            urlencode($this->databaseName),
            urlencode($this->bucketName)
        );
    }
598154
protected function buildPath()
    {
        $this->basename = $this->filename;

        if (!empty($this->extension)) {
            $this->basename .= '.' . $this->extension;
        }

        $this->path = $this->dirname;

        if (!empty($this->basename)) {
            $this->path .= '/' . $this->basename;
        }

        return $this;
    }
542883
public function createTableOfContent()
    {
        $basepath   = $this->config['basepath'];
        $pattern    = $this->config['pattern'];
        $route      = $this->di->request->getRoute();

        // if dir, add index if file exists.
        // partly for adding doc/index to work
        // partly to make doc/ generate proper toc.
        $baseroute  = dirname($route);
        $path       = $basepath . '/' . $baseroute . '/' . $pattern;

        $toc = [];
        foreach (glob($path) as $file) {
            $parts    = pathinfo($file);
            $filename = $parts['filename'];

            $title = $this->getTitleFromFirstLine($file);
            $file2route = substr($filename, strpos($filename, '_') + 1);

            $url = $baseroute . '/' . $file2route;
            /*
            if ($file2route == 'index' ) {
                $url = $baseroute;
            }*/

            // Create level depending on the file id
            $id = substr($filename, 0, strpos($filename, '_'));
            $level = 2;
            if ($id % 100 === 0) {
                $level = 0;
            } elseif ($id % 10 === 0) {
                $level = 1;
            }

            $toc[$url] = [
                'title'     => $title,
                'filename'  => $parts['basename'],
                'level'     => $level,
            ];
        }

        return $toc;
    }
821287
public function getPath()
    {
        $path = static::getBasePath() . $this->path;

        if (file_exists($path)) {
            return $path;
        } elseif (file_exists($this->defaultStubFolderPath . $this->path)) {
            return $this->defaultStubFolderPath . $this->path;
        }

        throw new FileNotFoundException("File does not exist at path {$path}");
    }
1190457
public function getPath()
    {
        if (null == $this->path) {
            $this->path = $this->input->getOption('source-path');
            if (!is_dir($this->path)) {
                throw new FileNotFoundException(
                    "The provided path was not found in your system."
                );
            }
        }
        return $this->path;
    }
68323
public function path(){

        $args = \func_get_args();

        switch (\count($args)){

            case 1:

                $file  = $args[0];

                if ($this->isAbsolutePath($file) && \file_exists($file)) {
                    return $file;
                }

                $parts = \explode(':', $file, 2);

                if (count($parts)==2){
                    if (!isset($this->paths[$parts[0]])) return false;

                    foreach ($this->paths[$parts[0]] as &$path){
                        if (\file_exists($path.$parts[1])){
                            return $path.$parts[1];
                        }
                    }
                }

                return false;

            case 2:

                if (!isset($this->paths[$args[0]])) {
                    $this->paths[$args[0]] = [];
                }
                \array_unshift($this->paths[$args[0]], \rtrim(\str_replace(DIRECTORY_SEPARATOR, '/', $args[1]), '/').'/');

                return $this;
        }

        return null;
    }
531237
public function getFilename()
    {
        if ($this->isDirty && $this->filename) {
            return $this->filename;
        }

        if ($this->riakGridFSFile instanceof \RiakGridFSFile && $filename = $this->riakGridFSFile->getFilename()) {
            return $filename;
        }

        return $this->filename;
    }
409601
public function getFilePath() : ?string 
    {
        if ( ! $this->hasFilePath()) {
            $this->setFilePath($this->getDefaultFilePath());
        }
        return $this->filePath;
    }
242454
public function getCurrentPath()
    {

        // if no filepath defined => autocreate path from table name
        if (!static::$filepath) {
            static::$filepath = "files/" . $this->getTable();
        }

        static::$currentPath = public_path(static::$filepath . '/' . $this->id);

        if (!is_dir(static::$currentPath)) {
            try {
                @mkdir(static::$currentPath, 0777, true);
            } catch (Exception $e) {
                Api::handleError($e);
            }
        }

        return static::$currentPath;
    }
78639
private function getFilePath()
    {
        $fullname = $this->fullName;
        $rootPath = Yii::getAlias('@webroot');

        if (substr($fullname, 0, 1) != '/') {
            $fullname = '/' . $fullname;
        }

        return $rootPath . $fullname;
    }
466900
private function generateNewFilename()
    {
        $time = time();
        $filename = $this->filename;
        $ext =  end(explode(".", $filename));
        do {
            $filename = substr(md5($filename. $time), 0, 8) . '.' . $ext;
        } while (file_exists($this->uploadDirectory . DIRECTORY_SEPARATOR . $filename));
        return $filename;
    }
1277434
final public function getNewFileName()
    {
        if (null === $this->_newFileName) {
            if (isset($this->uploaded['name'])) {
                $this->_newFileName = NamesHelper::transliterate($this->uploaded['name'], true);
            }
        }
        return $this->_newFileName;
    }
120000
protected function _createFile()
        {
            do {
                $this->_filename = $this->getPath() .  mt_rand() . '.html';
            } while(File::exists($this->_filename));

            /**
             * create an empty file
             */
            File::put($this->_filename, $this->getHtml());
            chmod($this->_filename, 0777);

            return $this->_filename;
        }
1356485
public function getPublicPath(): string
    {
        if (is_null($this->publicPath)) {
            return $this->basePath.DIRECTORY_SEPARATOR.'public';
        }

        return $this->publicPath;
    }
200313
protected function sparkPath()
    {
        return $this->command->path.'/spark-new/'.basename(
            (new Filesystem)->directories($this->command->path.'/spark-new')[0]
        );
    }
1319068
protected function prepareBasePath()
    {
        $baseUrl = $this->getBaseUrl();
        if (empty($baseUrl)) {
            return '';
        }

        $filename = basename($this->server->get('SCRIPT_FILENAME'));
        if (basename($baseUrl) === $filename) {
            $basePath = \dirname($baseUrl);
        } else {
            $basePath = $baseUrl;
        }

        if ('\\' === \DIRECTORY_SEPARATOR) {
            $basePath = str_replace('\\', '/', $basePath);
        }

        return rtrim($basePath, '/');
    }
217068
public function current()
    {
        $file = parent::current();
        return ($file !== null) ? new MongoGridFSFile($this->gridfs, $file) : null;
    }