private function replaceParentSymlinksByCopies($path)
{
$previousPath = null;
// Collect all paths that MUST NOT be symlinks after doing the
// replace operation.
//
// Example:
//
// $dirsToKeep = ['/path/to/webmozart', '/path/to/webmozart/views']
//
// Before:
// /webmozart -> target
//
// After:
// /webmozart
// /config -> target/config
// /views
// /index.html.twig -> target/views/index.html.twig
$dirsToKeep = array();
while ($previousPath !== ($path = Path::getDirectory($path))) {
$filesystemPath = $this->baseDir . $path;
$dirsToKeep[] = $filesystemPath;
if (is_link($filesystemPath)) {
$this->replaceLinkByCopy($filesystemPath, $dirsToKeep);
return;
}
$previousPath = $path;
}
}