Skip to content

Commit

Permalink
fix unix root dir issue
Browse files Browse the repository at this point in the history
  • Loading branch information
chr-hertel committed Feb 12, 2020
1 parent ded655b commit c7a56bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/Symfony/Component/Finder/Finder.php
Expand Up @@ -797,6 +797,10 @@ private function searchInDirectory(string $dir): \Iterator
*/
private function normalizeDir(string $dir): string
{
if ('/' === $dir) {
return $dir;
}

$dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR);

if (preg_match('#^(ssh2\.)?s?ftp://#', $dir)) {
Expand Down
Expand Up @@ -70,7 +70,11 @@ public function current()
}
$subPathname .= $this->getFilename();

return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
if ('/' !== $basePath = $this->rootPath) {
$basePath .= $this->directorySeparator;
}

return new SplFileInfo($basePath.$subPathname, $this->subPath, $subPathname);
}

/**
Expand Down

0 comments on commit c7a56bc

Please sign in to comment.