Returns path to the right directory to dump and save config.yml file.

@param string $baseDir config base directory

@return string
513594
private function getConfigDumpRightDirectory($baseDir)
    {
        $configDumpDir = $this->app->getBaseRepository();
        if ($this->persistPerContext && ApplicationInterface::DEFAULT_CONTEXT !== $this->app->getContext()) {
            $configDumpDir .= DIRECTORY_SEPARATOR.$this->app->getContext();
        }

        $configDumpDir .= DIRECTORY_SEPARATOR.'Config';
        if ($this->persistPerEnvironment && ApplicationInterface::DEFAULT_ENVIRONMENT !== $this->app->getEnvironment()) {
            $configDumpDir .= DIRECTORY_SEPARATOR.$this->app->getEnvironment();
        }

        $key = $this->app->getContainer()->get('bundle.loader')->getBundleIdByBaseDir($baseDir);
        if (null !== $key) {
            $configDumpDir .= DIRECTORY_SEPARATOR.'bundle'.DIRECTORY_SEPARATOR.$key;
        }

        if (!is_dir($configDumpDir) && false === @mkdir($configDumpDir, 0755, true)) {
            throw new \Exception('Unable to create config dump directory');
        }

        return $configDumpDir;
    }
1255406
public function MsgHTML($message, $basedir = '') {
    preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
    if(isset($images[2])) {
      foreach($images[2] as $i => $url) {
        // do not change urls for absolute images (thanks to corvuscorax)
        if (!preg_match('#^[A-z]+://#',$url)) {
          $filename = basename($url);
          $directory = dirname($url);
          ($directory == '.')?$directory='':'';
          $cid = 'cid:' . md5($filename);
          $ext = pathinfo($filename, PATHINFO_EXTENSION);
          $mimeType  = self::_mime_types($ext);
          if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
          if ( strlen($directory) > 1 && substr($directory,-1) != '/') { $directory .= '/'; }
          if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
            $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
          }
        }
      }
    }
    $this->IsHTML(true);
    $this->Body = $message;
    $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
    if (!empty($textMsg) && empty($this->AltBody)) {
      $this->AltBody = html_entity_decode($textMsg);
    }
    if (empty($this->AltBody)) {
      $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . "\n\n";
    }
  }
139808
protected function _path($path, $forceDir)
    {
        if ($forceDir) {
            return is_dir($path) ? $path : null;
        }
        if (file_exists($file = $path . '.php')) {
            return $file ;
        }
        if (file_exists($file = $path . '.hh')) {
            return $file;
        }
        if (is_dir($path)) {
            return $path;
        }
    }
368603
public function getPathWithoutBase($basedir)
    {
        if (!StringHelper::endsWith(self::$separator, $basedir)) {
            $basedir .= self::$separator;
        }
        $path = $this->getPath();
        if (substr($path, 0, strlen($basedir)) != $basedir) {
            //path does not begin with basedir, we don't modify it
            return $path;
        }

        return substr($path, strlen($basedir));
    }
456048
public function getFilePath($filename, $basedir, $relative)
    {
        // Validating the 'file' information
        $files = (array) $filename;

        // Processing the file information
        foreach ($files as $index => $file) {
            $absolutefilename = (($relative === false) ? ($basedir . PhingFile::$separator) : '');
            $absolutefilename .= $file;
            if ($relative === false) {
                $files[$index] = (new FileUtils())->normalize($absolutefilename);
            } else {
                $files[$index] = $absolutefilename;
            }
        }

        return (is_array($filename) ? $files : $files[0]);
    }
299734
public function generateBaseDirectoryPath($config)
    {
        $base = $config->get('Cache.SerializerPath');
        $base = is_null($base) ? HTMLPURIFIER_PREFIX . '/HTMLPurifier/DefinitionCache/Serializer' : $base;
        return $base;
    }
1250408
public static function register($baseDir = null)
    {
        $key = $baseDir ? $baseDir : 0;

        if (!isset(self::$instances[$key])) {
            self::$instances[$key] = new self($baseDir);
        }

        $loader = self::$instances[$key];
        spl_autoload_register(array($loader, 'autoload'));

        return $loader;
    }
481295
protected function _getBaseDownloadDirPath()
    {
        $sConfigValue = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('sDownloadsDir');

        //Unix full path is set
        if ($sConfigValue && $sConfigValue[0] == DIRECTORY_SEPARATOR) {
            return $sConfigValue;
        }

        //relative path is set
        if ($sConfigValue) {
            $sPath = getShopBasePath() . DIRECTORY_SEPARATOR . $sConfigValue;

            return $sPath;
        }

        //no path is set
        $sPath = getShopBasePath() . "/out/downloads/";

        return $sPath;
    }
387460
public function getBasePath() : string
    {
        $baseUri = $this->getBase();
        $path = ltrim($this->getPath(), "/");

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

        return $absoluteUri;
    }
1177627
public function basePath()
    {
        if ($this->dirname && $this->basename) {
            return ($this->dirname .'/'. $this->basename);
        }

        return null;
    }
1321655
private function loadFromCache($basedir)
    {
        if (true === $this->debug) {
            return false;
        }

        if (null === $this->cache) {
            return false;
        }

        $cached_parameters = $this->cache->load($this->getCacheId($basedir), false, $this->getCacheExpire($basedir));
        if (false === $cached_parameters) {
            return false;
        }

        $parameters = @\unserialize($cached_parameters);
        if (!is_array($parameters)) {
            return false;
        }

        foreach ($parameters as $section => $data) {
            $this->setSection($section, $data, true);
        }

        return true;
    }
486091
private function loadFromBaseDir($basedir, $overwrite = false)
    {
        foreach ($this->getYmlFiles($basedir) as $filename) {
            $this->loadFromFile($filename, $overwrite);
        }
    }
952646
public function getBinDir(): string
    {
        $binDir = $this->config->getBinDir();
        if (!$this->fileSystem->exists($binDir)) {
            throw new RuntimeException('The configured BIN directory could not be found.');
        }

        return $this->getRelativePath($binDir);
    }
967004
static public function createSplFileInfo($baseDir, $path)
    {
        $absPath = realpath($path);
        $baseDirLen = strlen($baseDir);

        if($baseDir === substr($absPath,0,$baseDirLen)){
            $subPathName = ltrim(substr($absPath,$baseDirLen),'\\/');
            $dir = dirname($subPathName);
            $subPath = '.' === $dir ? '':$dir;
        }else{
            $subPath = $subPathName = '';
        }

        return new SplFileInfo($absPath,$subPath,$subPathName);
    }
255492
public function getBaseDir(): string
    {
        // Four levels back.
        $ds = DIRECTORY_SEPARATOR;
        $dir = __DIR__ . "$ds..$ds..$ds..$ds..$ds";
        $base_dir = realpath($dir);
        if (!$base_dir) {
            $message = 'Cannot resolve project base directory.';
            throw new Exception\RuntimeException($message);
        }

        return $base_dir;
    }
152819
protected function getPackageDir() {
		
		$baseDir    = realpath(getcwd()).DIRECTORY_SEPARATOR;
		$configDir  = (is_dir($baseDir."_config")) ? "_config" : "config";
		$configFile = $baseDir.$configDir.DIRECTORY_SEPARATOR."config.yml";
		
		if (file_exists($configFile)) {
			$configData = file_get_contents($configFile);
			preg_match("/packagesDir:([ ]+)?([\"'])?([A-z0-9-]{1,})([\"'])?([ ]+)?/",$configData,$matches);
			$packageDir = (isset($matches[3])) ? $matches[3] : "packages"; // provide an expected default just in case
		} else {
			$packageDir = "vendor";
		}
		
		return $packageDir;
		
	}
867254
protected static function mergePaths(Uri $baseUri, string $relative): string
    {
        $basePath = $baseUri->path();

        if ($baseUri->authority() !== null && $basePath === '') {
            return sprintf('/%s', $relative);
        }

        $last = strrpos($basePath, '/');

        if ($last !== false) {
            return sprintf('%s/%s', substr($basePath, 0, $last), $relative);
        }

        return $relative;
    }