Resolves a path relative to the repository into an absolute path

@param   string|array  $path     A local path (or an array of paths)
@return  string|array            Either a single path or an array of paths is returned
320523
public function resolveFullPath($path)
    {
        if (is_array($path)) {
            $paths  = array();
            foreach ($path as $p) {
                $paths[]    = $this->resolveFullPath($p);
            }
            return $paths;
        } else {
            if (strpos($path, $this->getRepositoryPath()) === 0) {
                return $path;
            }
            $path  = FileSystem::normalizeDirectorySeparator($path);
            $path  = ltrim($path, '/');
            return $this->getRepositoryPath().'/'.$path;
        }
    }
1277754
private function fixPath($path)
    {
        $helper = $this->getAssets();

        if ($helper === null) {
            return $path;
        }

        $url = $helper->getUrl($path);

        if (substr($path, -1) === '/' && ($position = strpos($url, '?')) !== false) {
            $url = substr($url, 0, $position);
        }

        return $url;
    }
1073233
private function resolveRemotePath($path)
    {
        if (!isset($this->resolvedRemotePath[$path])) {
            $resolvedPath = $this->volatileFolder->getNewPath();
            if ($this->remoteFilesystem->copy($path, $path, $resolvedPath) !== true) {
                throw new Exception\PathNotFound($path);
            }
            $this->resolvedRemotePath[$path] = $resolvedPath;
        }

        return $this->resolvedRemotePath[$path];
    }
1272960
public function resolveArrayPath($path)
    {
        $path = explode('.', $this->escape($path));
        $root = $path[0];
        unset($path[0]);

        $arrayPath = '["'.implode('"]["', $path).'"]';

        $arrayBracket = '->';
        $arrayBracketEnd = '';

        if ($this->isArray()) {
            $arrayBracket = '["';
            $arrayBracketEnd = '"]';
        }

        return '$this->object'.$arrayBracket.$root.$arrayBracketEnd.$arrayPath;
    }
395613
public function getAsset($path)
    {
        // Absolute path will not be in manifest
        if ($path[0] === '/') {
            return $this->getUrl($path);
        }

        // Get manifest
        $asset = $this->manifest->get($path);

        return $this->getUrl('/assets/' . trim($asset, '/'));
    }
460643
private function get_relative_path( $path ) {
            $module_root_dir = $this->get_module_root_dir_path();
            if ( 0 === strpos( $path, $module_root_dir ) ) {
                $path = substr( $path, strlen( $module_root_dir ) );
            }

            return $path;
        }
908582
public function resolve($path)
    {
        if ($path[0] !== '@') {
            return DIRECTORY_SEPARATOR === '/' ? $path : strtr($path, '\\', '/');
        }

        if (strpos($path, '{') !== false && preg_match_all('#{([^\}]+)}#', $path, $matches)) {
            foreach ((array)$matches[1] as $k => $match) {
                if (is_numeric($match)) {
                    $replaced = substr(function_exists('random_bytes') ? bin2hex(random_bytes($match / 2 + 1)) : md5(uniqid(mt_rand(), true)), 0, $match);
                } else {
                    /** @noinspection UnSafeIsSetOverArrayInspection */
                    $ts = isset($ts) ? $ts : time();
                    $replaced = date($match, $ts);
                }

                $path = str_replace($matches[0][$k], $replaced, $path);
            }
        }

        if (DIRECTORY_SEPARATOR === '\\') {
            $path = strtr($path, '\\', '/');
        }

        if (($pos = strpos($path, '/')) === false) {
            if (!isset($this->_aliases[$path])) {
                throw new InvalidArgumentException(['`:alias` is not exists', 'alias' => $path]);
            }
            return $this->_aliases[$path];
        }

        $alias = substr($path, 0, $pos);

        if (!isset($this->_aliases[$alias])) {
            throw new InvalidArgumentException(['`:alias` is not exists for `:path`', 'alias' => $alias, 'path' => $path]);
        }

        return $this->_aliases[$alias] . substr($path, $pos);
    }
639820
static public function truePath($path)
    {
        // From Magento Mass Import utils (MIT)
        // http://sourceforge.net/p/magmi/git/ci/master/tree/magmi-0.8/inc/magmi_utils.php

        // whether $path is unix or not
        $unipath = strlen( $path ) == 0 || $path{0} != '/';
        // attempts to detect if path is relative in which case, add cwd
        if ( strpos( $path, ':' ) === false && $unipath ){
            $path = getcwd() . DIRECTORY_SEPARATOR . $path;
        }
        // resolve path parts (single dot, double dot and double delimiters)
        $path      = str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $path );
        $parts     = array_filter( explode( DIRECTORY_SEPARATOR, $path ), 'strlen' );
        $absolutes = array();
        foreach ( $parts as $part ) {
            if ( '.' == $part ) {
                continue;
            }
            if ( '..' == $part ) {
                array_pop( $absolutes );
            } else {
                $absolutes[ ] = $part;
            }
        }
        $path = implode( DIRECTORY_SEPARATOR, $absolutes );
        // put initial separator that could have been lost
        $path = !$unipath ? '/' . $path : $path;
        return $path;
    }
642781
private function fileRelativePath($path)
    {
        $path = $this->fileWebpath($path);
        // @todo This wont work for files not located on the current server...
        $path = str_replace_first(env('APP_URL'), '', $path);
        $path = str_replace(' ', '%20', $path);

        return $path;
    }
314998
public function resolve(
        AbsolutePathInterface $basePath,
        PathInterface $path
    ) {
        if ($path instanceof AbsolutePathInterface) {
            return $path;
        }

        return $basePath->join($path);
    }
351257
private function repositoryFromPath($path)
    {
        $directory = $this->resolvePath($path);
        $repository = new GitRepository($directory);

        return $repository;
    }
1154902
protected function _relativizePath($path)
    {
        $plugins = Plugin::loaded();
        $index = array_search('AssetCompress', $plugins);
        unset($plugins[$index]);

        foreach ($plugins as $plugin) {
            $pluginPath = Plugin::path($plugin) . 'webroot';
            if (strpos($path, $pluginPath) === 0) {
                return str_replace($pluginPath, '/' . Inflector::underscore($plugin), $path);
            }
        }
        $path = str_replace(WWW_ROOT, '/', $path);

        return str_replace(DS, '/', $path);
    }
1220572
public function resolvePath(string $relativePath): string
    {
        $path     = [];
        $absolute = (strpos($relativePath, '/') === 0);
        foreach (explode('/', $relativePath) as $part) {
            // ignore parts that have no value
            if (empty($part) || $part === '.') {
                continue;
            }

            if ($part !== '..') {
                $path[] = $part;
                continue;
            }
            if (count($path) > 0) {
                // going back up? sure
                array_pop($path);
                continue;
            }
            throw new \RuntimeException('Relative path resolves above root path.');
        }

        $return = implode('/', $path);
        if ($absolute) {
            $return = "/$return";
        }

        return $return;
    }
1026926
public function relativePath($path = null)
    {
        if (null === $path) {
            return str_replace(asset('/'), '', $this->relativePath);
        }

        $this->relativePath = $path;

        return $this;
    }
38645
protected function normalizePath($path)
    {
        $path = parent::normalizePath($path);
        return $this->getMultiRepositoryPath($path) ?: $path;
    }
381145
protected function getRelativePath($path = null)
    {
        if (!isset($path)) {
            $path = $this->scanner->getInitialPath(true);
        }

        return gplcart_path_normalize(gplcart_path_relative($path));
    }
740917
protected function makePath($path)
    {
        $path = $this->fs->isAbsolutePath($path)
            ? $path
            : base_path($path);
        return Paths::fix($path);
    }