From d897956362fbb167715c8bf31b1489adc49654cc Mon Sep 17 00:00:00 2001 From: Nicole Cordes Date: Sat, 30 Jan 2016 18:41:36 +0100 Subject: [PATCH] Ensure backend slashes for symlinks on Windows systems Resolves: #17614 --- src/Symfony/Component/Filesystem/Filesystem.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 0009eb7f7d..b5426a402c 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -301,10 +301,15 @@ class Filesystem */ 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, '/', '\\'); - return; + if ($copyOnWindows) { + $this->mirror($originDir, $targetDir); + + return; + } } $this->mkdir(dirname($targetDir));