Fix bug with drive names of different cases
parent
d22b80d13b
commit
680db4d1da
src/Composer/Downloader/Util
tests/Composer/Test/Downloader/Util
|
@ -58,8 +58,8 @@ class Filesystem
|
|||
if (dirname($from) === dirname($to)) {
|
||||
return './'.basename($to);
|
||||
}
|
||||
$from = rtrim(strtr($from, '\\', '/'), '/');
|
||||
$to = rtrim(strtr($to, '\\', '/'), '/');
|
||||
$from = lcfirst(rtrim(strtr($from, '\\', '/'), '/'));
|
||||
$to = lcfirst(rtrim(strtr($to, '\\', '/'), '/'));
|
||||
|
||||
$commonPath = $to;
|
||||
while (strpos($from, $commonPath) !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
|
||||
|
@ -93,8 +93,8 @@ class Filesystem
|
|||
if ($from === $to) {
|
||||
return $directories ? '__DIR__' : '__FILE__';
|
||||
}
|
||||
$from = strtr($from, '\\', '/');
|
||||
$to = strtr($to, '\\', '/');
|
||||
$from = lcfirst(strtr($from, '\\', '/'));
|
||||
$to = lcfirst(strtr($to, '\\', '/'));
|
||||
|
||||
$commonPath = $to;
|
||||
while (strpos($from, $commonPath) !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
|
||||
|
|
|
@ -51,6 +51,7 @@ class FilesystemTest extends TestCase
|
|||
array('C:/Temp', 'C:\Temp\test', true, "__DIR__ . '/test'"),
|
||||
array('/tmp/test', '/tmp', true, "dirname(__DIR__)"),
|
||||
array('/tmp', '/tmp/test', true, "__DIR__ . '/test'"),
|
||||
array('C:/Temp', 'c:\Temp\test', true, "__DIR__ . '/test'"),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -81,6 +82,7 @@ class FilesystemTest extends TestCase
|
|||
array('/tmp/test/sub', '/tmp', "../"),
|
||||
array('/tmp', '/tmp/test', "test"),
|
||||
array('C:/Temp', 'C:\Temp\test', "test"),
|
||||
array('C:/Temp', 'c:\Temp\test', "test"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue