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