Get the storage directory path.

@param string $path

@return string
548333
public function storagePath($path = '')
    {
        if (defined('THEMOSIS_ROOT')) {
            return $this->rootPath('storage').($path ? DIRECTORY_SEPARATOR.$path : $path);
        }

        return $this->contentPath('storage').($path ? DIRECTORY_SEPARATOR.$path : $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;
    }
1032342
public function preparePathDirectory(string $path): string
    {
        $translatedPath = Yii::getAlias($path);

        if (!is_dir($translatedPath)) {
            FileHelper::createDirectory($translatedPath);
        }

        return $translatedPath;
    }
1032454
protected function _getRalativePath($path)
    {
        if ($path) {
            $rootPath = str_replace(array('/', '\\'), '/', self::$_config['root']);

            $path = str_replace(array('/', '\\'), '/', $path);
            $path = str_replace($rootPath, '/', $path);
            $path = str_replace('//', '/', $path);
            $path = trim($path, '/');
        }
        return $path;
    }
854607
public function localize_folderpath($path)
    {
        $protect_folders = $this->config->get('protect_default_folders');
        $delimiter       = $this->storage->get_hierarchy_delimiter();
        $path            = explode($delimiter, $path);
        $result          = array();

        foreach ($path as $idx => $dir) {
            $directory = implode($delimiter, array_slice($path, 0, $idx+1));
            if ($protect_folders && $this->storage->is_special_folder($directory)) {
                unset($result);
                $result[] = $this->localize_foldername($directory);
            }
            else {
                $result[] = rcube_charset::convert($dir, 'UTF7-IMAP');
            }
        }

        return implode($delimiter, $result);
    }
317963
public static function getFolder(string $path)
    {
        $arrFolders = explode(DIRECTORY_SEPARATOR, $path);
        $fullPath = "";
        if ($arrFolders[0] !== "") {
            $fullPath = $arrFolders[0];
        }
        unset($arrFolders[0]);
        foreach ($arrFolders as $folder) {
            $fullPath .= DIRECTORY_SEPARATOR . $folder;
            if (file_exists($fullPath) && is_dir($fullPath)) {
                continue;
            }
            mkdir($fullPath, 0775);
        }
        return $path;
    }
715595
private function get_new_path( $path ){
		if( preg_match( '/^(?:[a-zA-Z0-9]+\:|\/\/|\#)/', $path ) ){
			return $path;
		}

		$params = '';
		if( preg_match( '/^(.*?)([\?\#].*)$/', $path, $matched ) ){
			$path = $matched[1];
			$params = $matched[2];
		}

		$rewrite_direction = @$this->device_info->rewrite_direction;
		@preg_match('/^(.*)2(.*)$/', $rewrite_direction, $matched);
		$rewrite_from = @$matched[1];
		$rewrite_to   = @$matched[2];
		if( !strlen($rewrite_from) ){
			$rewrite_from = 'rewrited';
		}
		if( !strlen($rewrite_to) ){
			$rewrite_to = 'origin';
		}

		$type = 'relative';
		if( preg_match('/^\//', $path) ){
			$type = 'absolute';
		}elseif( preg_match('/^\.\//', $path) ){
			$type = 'relative_dotslash';
		}
		$is_slash_closed = false;
		if( preg_match('/\/$/', $path) ){
			$is_slash_closed = true;
			$path .= $this->px->get_directory_index_primary();
		}

		// ------------------

		$cd_origin = $this->px->fs()->normalize_path( $this->px->fs()->get_realpath( $this->path_original ) );
		$cd_origin = preg_replace( '/^(.*)(\/.*?)$/si', '$1', $cd_origin );
		if( !strlen($cd_origin) ){
			$cd_origin = '/';
		}

		$cd_rewrited = $this->px->fs()->normalize_path( $this->px->fs()->get_realpath( $this->path_rewrited ) );
		$cd_rewrited = preg_replace( '/^(.*)(\/.*?)$/si', '$1', $cd_rewrited );
		if( !strlen($cd_rewrited) ){
			$cd_rewrited = '/';
		}

		// ------------------

		$realpath_from = $cd_origin;
		$realpath_to = $this->px->fs()->normalize_path($this->px->fs()->get_realpath($path, $cd_origin));

		if( $rewrite_from == 'rewrited' ){
			$realpath_from = $cd_rewrited;
		}
		if( $rewrite_to == 'rewrited' ){
			$realpath_to = $this->path_rewriter->rewrite($realpath_to, $this->device_info->path_rewrite_rule);
			$realpath_to = $this->px->fs()->normalize_path($this->px->fs()->get_realpath($realpath_to, $cd_origin));
		}

		// ------------------

		if( $type == 'relative' || $type == 'relative_dotslash' ){
			$realpath_to = $this->px->fs()->normalize_path($this->px->fs()->get_relatedpath($realpath_to, $realpath_from));
			if( $type == 'relative' ){
				$realpath_to = preg_replace( '/^\.\//si', '', $realpath_to );
			}elseif( $type == 'relative_dotslash' ){
				$realpath_to = preg_replace( '/^(\.\/)?/si', './', $realpath_to );
			}
		}

		$realpath_to = $this->px->fs()->normalize_path($realpath_to);
		if( $is_slash_closed ){
			$realpath_to = preg_replace( '/'.$this->px->get_directory_index_preg_pattern().'$/', '', $realpath_to );
		}
		$realpath_to .= $params;

		return $realpath_to;
	}
469923
public function getFileName(string $path) : string
    {
        if (!$this->exists($path)) {
            throw new FileSystemException("File at path $path not found");
        }

        return pathinfo($path, PATHINFO_FILENAME);
    }
163595
public function dataDir($path = '')
    {
        $path = (empty($path) || starts_with($path, DIRECTORY_SEPARATOR)) ? $path : "/{$path}";

        return __COUNTRIES_DIR__.$this->toDir("/src/data$path");
    }
837509
private function get_thumbnail_path($path) {
	$a = explode($this->separator, $path);
	$path_parts = pathinfo($path);
	$thumbnail_path = $a[0].$this->separator.'/'.$this->cachefolder.dirname(end($a)).'/';
	if(is_dir($path)) {
		$thumbnail_fullpath = $thumbnail_path;
	} else {
		$thumbnail_name = $path_parts['filename'] . '_' . $this->thumbnail_width . 'x' . $this->thumbnail_height . 'px.' . $path_parts['extension'];
		$thumbnail_fullpath = $thumbnail_path.$thumbnail_name;
	}
	return $thumbnail_fullpath;
}
1036928
protected function get_src_path( $path = '' ) {
        return rtrim( $this->get_path( $this->options->src_dir ), '/' ) .
            ( strlen( $path )  ? '/' . $path : '' );
    }
1071699
private function getPath($path)
    {
        return $this->root .
            ltrim(
                preg_replace(
                    sprintf('|%s{2,}|', preg_quote(DIRECTORY_SEPARATOR)),
                    DIRECTORY_SEPARATOR,
                    $path
                ),
                DIRECTORY_SEPARATOR
            );
    }
1060343
protected function get_folders( $path ) {
		if ( isset( $this->subfolders[ $path ] ) ) {
			return $this->subfolders[ $path ];
		}

		$this->subfolders[ $path ] = $this->search_folders( $path );
		return $this->subfolders[ $path ];
	}
406291
public function locate($path)
    {
        if (substr($path, 0, 1) == '@') {
            $path = $this->kernel->locateResource($path);
        } else {
            $path = $this->kernel->getRootDir() . DIRECTORY_SEPARATOR . $path;
        }

        return $path;
    }
326677
public function buildsPath(string $path = ''): string
    {
        return $this->basePath('builds'.($path ? DIRECTORY_SEPARATOR.$path : $path));
    }
49535
public static function getFileNameFromPath(string $path)
    {
        $split = explode('/', $path);
        $name = (string)end($split);

        return $name;
    }
996142
public function getPathRelativeToDirectory($path)
    {
        // Get the last segment of the directory as asset paths will be relative to this
        // path. We can then replace this segment with nothing in the assets path.
        $directoryLastSegment = substr($this->path, strrpos($this->path, '/') + 1);

        return trim(preg_replace('/^'.$directoryLastSegment.'/', '', $path), '/');
    }