Skip to content

Commit

Permalink
bug #17615 Ensure backend slashes for symlinks on Windows systems (cp…
Browse files Browse the repository at this point in the history
…sitgmbh)

This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes #17615).

Discussion
----------

Ensure backend slashes for symlinks on Windows systems

Resolves: #17614

Commits
-------

d897956 Ensure backend slashes for symlinks on Windows systems
  • Loading branch information
nicolas-grekas committed Mar 2, 2016
2 parents 36cb46a + d897956 commit 2e9e83e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Symfony/Component/Filesystem/Filesystem.php
Expand Up @@ -301,10 +301,15 @@ private function isReadable($filename)
*/
public function symlink($originDir, $targetDir, $copyOnWindows = false)
{
if ($copyOnWindows && !function_exists('symlink')) {
$this->mirror($originDir, $targetDir);
if ('\\' === DIRECTORY_SEPARATOR) {
$originDir = strtr($originDir, '/', '\\');
$targetDir = strtr($targetDir, '/', '\\');

if ($copyOnWindows) {
$this->mirror($originDir, $targetDir);

return;
return;
}
}

$this->mkdir(dirname($targetDir));
Expand Down

0 comments on commit 2e9e83e

Please sign in to comment.