8000 Do not trim backslash on Unix based systems · symfony/symfony@c65b064 · GitHub
[go: up one dir, main page]

Skip to content

Commit c65b064

Browse files
committed
Do not trim backslash on Unix based systems
1 parent 436bb3d commit c65b064

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/Symfony/Component/Finder/Finder.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,9 +629,9 @@ public function in($dirs)
629629

630630
foreach ((array) $dirs as $dir) {
631631
if (is_dir($dir)) {
632-
$resolvedDirs[] = rtrim($dir, '/\\');
632+
$resolvedDirs[] = $this->normalizeDir($dir);
633633
} elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
634-
$resolvedDirs = array_merge($resolvedDirs, array_map(function ($path) {return rtrim($path, '/\\'); }, $glob));
634+
$resolvedDirs = array_merge($resolvedDirs, array_map(function ($dir) {return $this->normalizeDir($dir); }, $glob));
635635
} else {
636636
throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
637637
}
@@ -794,4 +794,15 @@ private function resetAdapterSelection()
794794
return $properties;
795795
}, $this->adapters);
796796
}
797+
798+
/**
799+
* Normalizes given directory names by removing trailing slashes
800+
*
801+
* @param string $dir
802+
* @return string
803+
*/
804+
private function normalizeDir($dir)
805+
{
806+
return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
807+
}
797808
}

0 commit comments

Comments
 (0)
0