get base path
maybe path use alias. (e.g. like '@app' --> '/xx/yy/app')
you can define
$this->resolvePath = function($path) {
if ( $path{0} ==='@' ) {
// some handle logic ... ...
// $path = App::resolvePath($basePath);
}
return $path;
}
@return string
332673
public function getBasePath()
    {
        //
        if ($this->resolvePath && $this->resolvePath instanceof \Closure) {
            $pathHandler = $this->resolvePath;
            $this->basePath = $pathHandler($this->basePath);
        }

        return $this->basePath;
    }
924588
protected function realpath($path)
    {
        if ($path === '') {
            return $this->baseDir;
        }

        if ($path[0] === '/' || $path[1] === ':') {
            return $path;
        }

        return $this->baseDir . '/' . $path;
    }
1117525
private function getPath($path)
    {
        if ($this->basePath === '' || strpos($path, $this->basePath) === 0) {
            $path = substr($path, strlen($this->basePath)) ?: '';
        }

        return $path === '' ? '/' : $path;
    }
970029
public function baseUrl($path = null)
    {
        $backendUri = $this->uri();
        $baseUrl = Request::getBaseUrl();

        if ($path === null) {
            return $baseUrl . '/' . $backendUri;
        }

        $path = RouterHelper::normalizeUrl($path);
        return $baseUrl . '/' . $backendUri . $path;
    }
362359
public function getBaseUri()
    {
        $script = $this->get('script');
        $base   = str_replace('\\', '/', dirname($script));

        if ($base != '/') {
            $url = strtolower($this->get('scheme')) . $this->get('name') . $base;
        } else {
            $url = strtolower($this->get('scheme')) . $this->get('name');
        }

        return $url;
    }
1367034
public function baseUrl($path) {

        $url = '';

        if (\strpos($path, ':')===false) {

            /*
            if ($this->registry['base_port'] != '80') {
                $url .= $this->registry['site_url'];
            }
            */

            $url .= $this->registry['base_url'].'/'.\ltrim($path, '/');

        } else {
            $url = $this->pathToUrl($path);
        }

        return $url;
    }
949234
public function basePath($path = null) {
		$route = str_replace('.php', '', trim(Router::$route->route, '/'));

		$url_path = "//".Server::getName();
		$dir = ($route == 'install' || $route == 'update')?'vcs':'themes';
		$theme = ($route != 'install' && $route != 'update')?($this->getTheme().'/'):'';
		$file_path = '/'."$dir/".$theme."$path";

		return $url_path.(($path)?$file_path:'');
	}
12760
protected function getPath(): ?string
    {
        $path = $this->input->getOption('path');

        // First we will check for an explicitly specified path from the user. If one
        // exists we will use that as the path to the assets. This allows the free
        // storage of assets wherever is best for this developer's web projects.
        if (\is_null($path)) {
            return null;
        }

        return $this->laravel->basePath().'/'.$path;
    }
1308464
public function basePath(?string $basePath = null) {
        if ($basePath != null) {
            $this->basePath = $basePath;
        }
        return $this->basePath;
    }
472514
public function getPath()
    {
        $path = $this->path;

        if ( ! empty(static::$basePath)) {
            $path = static::$basePath.DS.ltrim($path, DS);
        }

        return $path;
    }
637108
public function getPath()
    {
        $path = parent::getPath();
        if ('' == $path)
        {
            $path = '/';
        }
        if ($this->siteRoot)
        {
            $path = substr($path, strlen($this->siteRoot));
        }
        return $path;
    }
928970
public function basePath($basePath)
    {
        if (strlen($basePath) > 1 && substr($basePath, -1) === '/') {
            $this->basePath = substr($basePath, 0, -1);
        } else {
            $this->basePath = $basePath;
        }

        return $this;
    }
500656
public function getRootPath()
    {
        $appPath = app_path();
        $folders = explode(DIRECTORY_SEPARATOR, $appPath);
        array_pop($folders);
        $rootPath = implode(DIRECTORY_SEPARATOR, $folders);

        return $rootPath . '/';
    }
1183404
public function getRelativePath()
    {
        $current = realpath('./');

        if ($current !== false && strpos(self::$path.'/', $current.'/') === 0) {
            return rtrim('./' . substr(self::$path, strlen($current) + 1), '\\/');
        }

        throw new \InvalidArgumentException(
            'Unable to resolve relative path to Textpattern installation location '.
            'from the current working directory.'
        );
    }
717508
public function getPath($path)
    {
        if (($basePath = $this->getBasePath()) !== null) {
            return $basePath.DIRECTORY_SEPARATOR.ltrim($path, '/\\');
        }

        return $path;
    }
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, '/');
    }
1177627
public function basePath()
    {
        if ($this->dirname && $this->basename) {
            return ($this->dirname .'/'. $this->basename);
        }

        return null;
    }