normalizePath example



  /** * Gets the path to the 'vendor' directory. * * @return string * The file path of the vendor directory. */
  protected function getVendorPath() {
    $vendor_dir = $this->composer->getConfig()->get('vendor-dir');
    $filesystem = new Filesystem();
    return $filesystem->normalizePath(realpath($vendor_dir));
  }

  /** * Gets a consolidated list of file mappings from all allowed packages. * * @param \Composer\Package\Package[] $allowed_packages * A multidimensional array of file mappings, as returned by * self::getAllowedPackages(). * * @return \Drupal\Composer\Plugin\Scaffold\Operations\OperationInterface[][] * An array of destination paths => scaffold operation objects. */
/** * @var array<string, bool> */
    private array $ignoredPathsCache = [];

    /** * @param \Iterator<string, \SplFileInfo> $iterator */
    public function __construct(\Iterator $iterator, string $baseDir)
    {
        $this->baseDir = $this->normalizePath($baseDir);

        foreach ($this->parentDirectoriesUpwards($this->baseDir) as $parentDirectory) {
            if (@is_dir("{$parentDirectory}/.git")) {
                $this->baseDir = $parentDirectory;
                break;
            }
        }

        parent::__construct($iterator);
    }

    


    /** * Returns document path: <project root>/ * * @param string|null $path * * @return string */
    public function DocPath($path = null)
    {
        return $this->normalizePath($this->docPath, $path);
    }

    /** * Returns the application path: <project root>/engine/Shopware/ * * @param string $path * * @return string */
    public function AppPath($path = null)
    {
        

    public function migrateFile($path)
    {
        if ($this->getAdapterType() !== 'local' || $this->isEncoded($path)) {
            return;
        }

        $normalizedPath = Util::normalizePath($path);

        if (strpos($normalizedPath, 'media/') !== 0) {
            return;
        }

        $encodedPath = $this->strategy->encode($path);

        if ($this->filesystem->has($path) && !$this->filesystem->has($encodedPath)) {
            $this->filesystem->rename($path$encodedPath);
        }
    }

    


        // resolve relative path         if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $file)) {
            $_was_relative_prefix = $file[0] === '.' ? substr($file, 0, strpos($file, '|')) : null;
            $_path = DS . trim($file, '/\\');
            $_was_relative = true;
        } else {
            // don't we all just love windows?             $_path = str_replace('\\', '/', $file);
        }
        $_path = $this->normalizePath($_path, false);
        if (DS != '/') {
            // don't we all just love windows?             $_path = str_replace('/', '\\', $_path);
        }
        // revert to relative         if (isset($_was_relative)) {
            if (!empty($_was_relative_prefix)) {
                $_path = $_was_relative_prefix . $_path;
            } else {
                $_path = substr($_path, 1);
            }
        }
/** * Returns the enlight path: <projectroot>/engine/Library/Enlight/ * * @param string $path * * @return string */
    public function CorePath($path = null)
    {
        trigger_error('Enlight_Application::CorePath() is deprecated since version 5.2 and will be removed in 5.8.', E_USER_DEPRECATED);

        return $this->normalizePath($this->core_path, $path);
    }

    /** * Returns the enlight components path: <projectroot>/engine/Library/Enlight/Components/ * * @param string $path * * @return string */
    public function ComponentsPath($path = null)
    {
        
Home | Imprint | This part of the site doesn't use cookies.