Bundle base directory getter.

@return string
194696
public function getConfigDirectory()
    {
        $directory = $this->baseDir.DIRECTORY_SEPARATOR.BundleInterface::CONFIG_DIRECTORY_NAME;
        if (false === is_dir($directory)) {
            $directory = $this->baseDir.DIRECTORY_SEPARATOR.BundleInterface::OLD_CONFIG_DIRECTORY_NAME;
        }

        return $directory;
    }
242572
protected function getAppBasePath()
    {
        $path = dirname($_SERVER['SCRIPT_FILENAME']);

        return (is_link($path)) ? dirname(readlink($path)) : dirname($path);
    }
883651
public function baseUrl()
    {
        if (isset($this->baseUrl)) {
            return $this->baseUrl;
        }

        $config = $this->getPackageConfig();

        if (isset($config['baseUrl'])) {
            return $config['baseUrl'];
        }

        return 'http://localhost:8888';
    }
1004117
public function getBasePath() : ?string 
    {
        if ( ! $this->hasBasePath()) {
            $this->setBasePath($this->getDefaultBasePath());
        }
        return $this->basePath;
    }
805941
public function getBundleIdByBaseDir($path)
    {
        $bundleId = null;
        foreach ($this->bundleInfos as $id => $data) {
            if (0 === strpos($path, $data['base_dir'])) {
                $bundleId = $id;
                break;
            }
        }

        return $bundleId;
    }
201155
public function getBinaryDirectories()
    {
        if (isset($this->raw->{'directories-bin'})) {
            $directories = (array) $this->raw->{'directories-bin'};
            $base = $this->getBasePath();

            array_walk(
                $directories,
                function (&$directory) use ($base) {
                    $directory = $base
                               . DIRECTORY_SEPARATOR
                               . Path::canonical($directory);
                }
            );

            return $directories;
        }

        return array();
    }
1224797
public function getCoreUtilsDir()
    {
        if (($sValue = $this->getViewConfigParam('coreutilsdir')) === null) {
            $sValue = $this->getConfig()->getCoreUtilsURL();
            $this->setViewConfigParam('coreutilsdir', $sValue);
        }

        return $sValue;
    }
410282
public function getBasePath()
    {
        if (null === $this->_basePath) {
            $class = Unit::getReflectionClass($this);
            $this->_basePath = dirname($class->getFileName());
        }
        return $this->_basePath;
    }
1132903
public function getWebroot()
    {
        if ($this->_webroot === null) {
            $this->_webroot = realpath(realpath($this->basePath) . DIRECTORY_SEPARATOR . $this->webrootDirectory);
        }
        
        return $this->_webroot;
    }
516851
private function getBundleFinder($baseDir)
    {
        $bundleBaseDir = $baseDir.self::BUNDLE_NAMESPACE;

        if (!(new Filesystem())->exists($bundleBaseDir)) {
            return null;
        }

        $bundleFinder = new Finder();
        $bundleFinder->directories()->in($bundleBaseDir)->depth('== 0')->notName('BundleBundle');

        return $bundleFinder;
    }
687740
protected function retrieveBundleWebFolder()
    {
        $asset = $this->asset;
        
        $namespacesFile = $this->kernel->getRootDir() . '/../vendor/composer/autoload_namespaces.php';
        if (file_exists($namespacesFile)) {
            $map = require $namespacesFile;
            foreach ($map as $namespace => $paths) {
                if ( ! is_array($paths)) {
                    $paths = array($paths);
                }
                
                foreach($paths as $path) {
                    if (strpos($this->asset, $path) !== false) {
                        preg_match('/Bundle(.*)/', $this->asset, $matches);
                        $asset = str_replace("\\", "", $namespace) . $matches[1];
                        break;
                    }
                }
            }
        }

        preg_match('/([^@\/][\w]+Bundle)\/(Resources\/public)?\/(.*)/', $asset, $matches);
        if (!empty($matches) && count($matches) == 4) {
            return sprintf('bundles/%s/%s', preg_replace('/bundle$/', '', strtolower($matches[1])), $matches[3]);
        }

        preg_match('/[\/]?(bundles.*)/', strtolower($asset), $matches);
        if (!empty($matches)) {
            return $matches[1];
        }

        $asset = str_replace("@", "", strtolower($asset));
        $bundleDir = preg_replace('/bundle$/', '', $asset);

        return ($bundleDir !== $asset) ? 'bundles/' . $bundleDir : null;
    }
347645
public function getCwd()
    {
        $path = $this->wrapper->pwd();

        if ('/' === $path) {
            return new Directory('/');
        }

        return $this->findDirectoryByName($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;
    }
533218
public function getBasePath()
    {
        if (isset($this->raw->{'base-path'})) {
            if (false === is_dir($this->raw->{'base-path'})) {
                throw new InvalidArgumentException(
                    sprintf(
                        'The base path "%s" is not a directory or does not exist.',
                        $this->raw->{'base-path'}
                    )
                );
            }

            return realpath($this->raw->{'base-path'});
        }

        return realpath(dirname($this->file));
    }
701490
static function BundleFolder($bundleName)
    {
        $packageBundles = self::PackageBundles();
        if (isset($packageBundles[$bundleName])) {
            return $packageBundles[$bundleName];
        }
        return Path::Combine(self::AppBundlesFolder(), $bundleName);
    }
121685
public function getRootDir()
    {
        static $dir;
        if (empty($dir)) {
            $rc = new \ReflectionClass(get_class($this));
            $dir = dirname(dirname($rc->getFileName()));
        }
        return $dir;
    }
295795
public function getDirectory()
    {
        $dir = clone $this;
        $dir->path = str_replace(DIRECTORY_SEPARATOR, '/', dirname($this->path));
        if (!$dir->path) $dir->path = '/';

        return $dir;
    }