Skip to content

Commit d897956

Browse files
Nicole Cordesnicolas-grekas
authored andcommitted
Ensure backend slashes for symlinks on Windows systems
Resolves: #17614
1 parent 36cb46a commit d897956

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,15 @@ private function isReadable($filename)
301301
*/
302302
public function symlink($originDir, $targetDir, $copyOnWindows = false)
303303
{
304-
if ($copyOnWindows && !function_exists('symlink')) {
305-
$this->mirror($originDir, $targetDir);
304+
if ('\\' === DIRECTORY_SEPARATOR) {
305+
$originDir = strtr($originDir, '/', '\\');
306+
$targetDir = strtr($targetDir, '/', '\\');
307+
308+
if ($copyOnWindows) {
309+
$this->mirror($originDir, $targetDir);
306310

307-
return;
311+
return;
312+
}
308313
}
309314

310315
$this->mkdir(dirname($targetDir));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy