Returns the absolute path to the servers document root directory

@param string $directoryToAppend The directory to append to the base directory

@return string The base directory with appended dir if given
547675
public function getBaseDirectory($directoryToAppend = null)
    {
        $baseDirectory = $this->getNamingDirectory()->search('php:env/baseDirectory');
        if ($directoryToAppend != null) {
            $baseDirectory .= $directoryToAppend;
        }
        return $baseDirectory;
    }
847798
public function getPathFilename()
    {
        $path = $this->getPath();

        if ($this->isInternal()) {
            return $this->serverRoot.$path;
        }

        $path = $this->documentRoot.$path;

        if (is_dir($path) === true) {
            $path .= '/index.html';
        }

        return preg_replace('/\/\/+/', '/', $path);
    }
788303
public function GetAppRoot () {
		if ($this->appRoot === NULL) {
			// `ucfirst()` - cause IIS has lower case drive name here - different from __DIR__ value
			$indexFilePath = ucfirst(str_replace(['\\', '//'], '/', $this->globalServer['SCRIPT_FILENAME']));
			$this->appRoot = strpos(__FILE__, 'phar://') === 0
				? 'phar://' . $indexFilePath
				: dirname($indexFilePath);
		}
		return $this->appRoot;
	}
1725
public function getDocumentRootPath()
    {
        /**
         * The absolute pathname of the currently executing script.
         * Notatka: If a script is executed with the CLI, as a relative path, such as file.php or ../file.php,
         * $_SERVER['SCRIPT_FILENAME'] will contain the relative path specified by the user.
         */
        if (isset($_SERVER['SCRIPT_FILENAME'])) {
            $sRealPath = dirname($_SERVER['SCRIPT_FILENAME']);
        }
        else {
            /**
             * realpath — Returns canonicalized absolute pathname
             */
            $sRealPath = realpath('.') ;
        }

        $sRealPath = $this->trimPathTrailingSlashes($sRealPath);

        /**
         * The filename of the currently executing script, relative to the document root.
         * For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar
         * would be /test.php/foo.bar.
         */
        $sSelfPath = dirname($_SERVER['PHP_SELF']);
        $sSelfPath = $this->trimPathTrailingSlashes($sSelfPath);

        return $this->trimPathTrailingSlashes(substr($sRealPath, 0, strlen($sRealPath) - strlen($sSelfPath)));
    }
1343618
protected function _getRelDir($path) {
        $filename = basename($path);
        $dir = substr($path, 0, strlen($path) - strlen($filename));
        return $dir;
    }
689924
function dir($root = false, $current = false)
    {
        $dir = $this->uri($current);
        if ($root){
            return DIR.trim($dir,'/').'/';
        }else{
            return $dir.'/';
        }
    }
1216174
public function getOutDir($absolute = true)
    {
        if ($absolute) {
            return $this->getConfigParam('sShopDir') . $this->_sOutDir . '/';
        } else {
            return $this->_sOutDir . '/';
        }
    }
1103995
public static function rootDir()
    {
        $instance = self::instance();
        if ( !$instance->RootDir )
        {
            $cwd  = getcwd();
            $self  = $instance->serverVariable( 'PHP_SELF' );
            if ( file_exists( $cwd . $instance->FileSeparator . $self ) or
                 file_exists( $cwd . $instance->FileSeparator . $instance->IndexFile ) )
            {
                $instance->RootDir = $cwd;
            }
            else
            {
                $instance->RootDir = null;
            }
        }
        return $instance->RootDir;
    }
81808
public function getConfdDir($relativePathToAppend = '')
    {
        return $this->realpath(
            $this->makePathAbsolute(
                $this->getSystemConfiguration()->getParam(DirectoryKeys::ETC_APPSERVER_CONFD) . $this->makePathAbsolute($relativePathToAppend)
            )
        );
    }
387460
public function getBasePath() : string
    {
        $baseUri = $this->getBase();
        $path = ltrim($this->getPath(), "/");

        $absoluteUri = $baseUri . (($path === "") ? "" : "/" . $path);

        return $absoluteUri;
    }
1317303
public function path()
    {
        $dirname = $this->dirname();

        if ($this->parent instanceof Root) { //at root

            return $dirname.$this->basename();
        }

        return sprintf('%s/%s', $dirname, $this->basename());

    }
395291
public function getConfDir($relativePathToAppend = '')
    {
        return $this->realpath(
            $this->makePathAbsolute(
                $this->getSystemConfiguration()->getParam(DirectoryKeys::ETC_APPSERVER) . $this->makePathAbsolute($relativePathToAppend)
            )
        );
    }
949964
public static function rootPath($directory) {
        $num = count(explode("/", $directory));
        $path = "";
        for ($i = 0; $i < $num; $i++)
            $path = self::join("..", $path);
        return $path;
    }
717508
public function getPath($path)
    {
        if (($basePath = $this->getBasePath()) !== null) {
            return $basePath.DIRECTORY_SEPARATOR.ltrim($path, '/\\');
        }

        return $path;
    }
1227294
private function getRootDirectory()
    {
        static $root;

        if (!$root) {
            $working = getcwd();
            $myself  = __DIR__;

            if (0 === strpos($myself, $working)) {
                // Local installation, the working directory is the root
                $root = $working;
            } else {
                // Global installation, back up above the vendor/ directory
                $root = realpath($myself . '/../../../../../');
            }
        }

        return $root;
    }
1213025
protected function getRootDirectory()
    {
        if ($this->addon) {
            $directories = $this->addon->config('addon.directories');

            if (! $directories) {
                $directories = ['classes'];
            }

            return $this->addon->path($directories[0]);
        }
        else {
            return parent::getRootDirectory();
        }
    }
280732
public static function base_path(?string $file = null)
  {
    $file = (substr($file, 0, 1) == DIRECTORY_SEPARATOR ? substr($file, 1) : $file);
    return config('app.dir') . $file;
  }