bug #17615 Ensure backend slashes for symlinks on Windows systems (cpsitgmbh)

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
This commit is contained in:
Nicolas Grekas 2016-03-02 14:41:11 +01:00
commit 2e9e83e635

View File

@ -301,10 +301,15 @@ class Filesystem
*/ */
public function symlink($originDir, $targetDir, $copyOnWindows = false) public function symlink($originDir, $targetDir, $copyOnWindows = false)
{ {
if ($copyOnWindows && !function_exists('symlink')) { if ('\\' === DIRECTORY_SEPARATOR) {
$this->mirror($originDir, $targetDir); $originDir = strtr($originDir, '/', '\\');
$targetDir = strtr($targetDir, '/', '\\');
return; if ($copyOnWindows) {
$this->mirror($originDir, $targetDir);
return;
}
} }
$this->mkdir(dirname($targetDir)); $this->mkdir(dirname($targetDir));