Improved FileSystem::pathinfoInternal()

This commit is contained in:
Matias Griese 2021-12-07 13:56:19 +02:00
parent 86cfba3bc9
commit 878de339e5

View File

@ -239,12 +239,12 @@ class Filesystem implements FilesystemInterface
if (null !== $scheme) {
$info['scheme'] = $scheme;
$dirname = isset($info['dirname']) && $info['dirname'] !== '.' ? $info['dirname'] : null;
$dirname = $info['dirname'] ?? '.';
if (null !== $dirname) {
if ('' !== $dirname && '.' !== $dirname) {
// In Windows dirname may be using backslashes, fix that.
if (DIRECTORY_SEPARATOR !== '/') {
$dirname = str_replace('\\', '/', $dirname);
$dirname = str_replace(DIRECTORY_SEPARATOR, '/', $dirname);
}
$info['dirname'] = $scheme . '://' . $dirname;