protected function addSymlinks(PackageInterface $package, $targetRoot, array $pathMap, $mode = self::DUPLICATE_FAIL)
    {
        if (empty($pathMap)) {
            return;
        }

        $packageRoot = $this->getInstallPath($package);
        $actions     = [];

        // Check the file map first and make sure nothing exists.
        foreach ($pathMap as $sourcePath => $targetPath) {
            $source = $this->filesystem->normalizePath($packageRoot . ($sourcePath ? ('/'.$sourcePath) : ''));
            $target = $this->filesystem->normalizePath($targetRoot . '/' . $targetPath);

            if ($this->canAddSymlink($source, $target, $mode)) {
                $actions[$source] = $target;
            }
        }

        // Only actually create the links if the checks are successful to prevent orphans.
        foreach ($actions as $source => $target) {
            $this->logSymlink($source, $target);

            $this->filesystem->ensureDirectoryExists(dirname($target));

            if (Platform::isWindows()) {
                $success = @symlink($source, $target);
            } else {
                $success = $this->filesystem->relativeSymlink($source, $target);
            }

            if (!$success) {
                throw new \RuntimeException('Failed to create symlink ' . $target);
            }
        }
    }
protected function addSymlinks(PackageInterface $package, $targetRoot, array $pathMap, $mode = self::DUPLICATE_FAIL)
    {
        if (empty($pathMap)) {
            return;
        }

        $packageRoot = $this->getInstallPath($package);
        $actions     = [];

        // Check the file map first and make sure nothing exists.
        foreach ($pathMap as $sourcePath => $targetPath) {
            $source = $this->filesystem->normalizePath($packageRoot . ($sourcePath ? ('/'.$sourcePath) : ''));
            $target = $this->filesystem->normalizePath($targetRoot . '/' . $targetPath);

            if ($this->canAddSymlink($source, $target, $mode)) {
                $actions[$source] = $target;
            }
        }

        // Only actually create the links if the checks are successful to prevent orphans.
        foreach ($actions as $source => $target) {
            $this->logSymlink($source, $target);

            $this->filesystem->ensureDirectoryExists(dirname($target));

            if (Platform::isWindows()) {
                $success = @symlink($source, $target);
            } else {
                $success = $this->filesystem->relativeSymlink($source, $target);
            }

            if (!$success) {
                throw new \RuntimeException('Failed to create symlink ' . $target);
            }
        }
    }
protected function addSymlinks ( PackageInterface $ package , $ targetRoot , array $ pathMap , $ mode = self :: DUPLICATE_FAIL ) { if ( empty ( $ pathMap ) ) { return ; } $ packageRoot = $ this -> getInstallPath ( $ package ) ; $ actions = [ ] ; // Check the file map first and make sure nothing exists. foreach ( $ pathMap as $ sourcePath => $ targetPath ) { $ source = $ this -> filesystem -> normalizePath ( $ packageRoot . ( $ sourcePath ? ( '/' . $ sourcePath ) : '' ) ) ; $ target = $ this -> filesystem -> normalizePath ( $ targetRoot . '/' . $ targetPath ) ; if ( $ this -> canAddSymlink ( $ source , $ target , $ mode ) ) { $ actions [ $ source ] = $ target ; } } // Only actually create the links if the checks are successful to prevent orphans. foreach ( $ actions as $ source => $ target ) { $ this -> logSymlink ( $ source , $ target ) ; $ this -> filesystem -> ensureDirectoryExists ( dirname ( $ target ) ) ; if ( Platform :: isWindows ( ) ) { $ success = @ symlink ( $ source , $ target ) ; } else { $ success = $ this -> filesystem -> relativeSymlink ( $ source , $ target ) ; } if ( ! $ success ) { throw new \ RuntimeException ( 'Failed to create symlink ' . $ target ) ; } } }
Creates symlinks for a map of relative file paths.
Key is the relative path to composer package, whereas "value" is relative to Contao root.

@param PackageInterface $package    The package being processed.
@param string           $targetRoot The target directory.
@param array            $pathMap    The path mapping.
@param int              $mode       The mode how to handle duplicate files.

@return void

@throws \RuntimeException When the symlink could not be created.
Creates symlinks for a map of relative file paths . Key is the relative path to composer package whereas value is relative to Contao root .