Merge pull request #10687 from xini/fix-classinfo-paths-windows

This commit is contained in:
Michal Kleiner 2023-03-01 20:56:49 +13:00 committed by GitHub
commit 94b24b2390
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -301,14 +301,14 @@ class ClassInfo
*/
public static function classes_for_file($filePath)
{
$absFilePath = Director::getAbsFile($filePath);
$absFilePath = Convert::slashes(Director::getAbsFile($filePath));
$classManifest = ClassLoader::inst()->getManifest();
$classes = $classManifest->getClasses();
$classNames = $classManifest->getClassNames();
$matchedClasses = [];
foreach ($classes as $lowerClass => $compareFilePath) {
if (strcasecmp($absFilePath ?? '', $compareFilePath ?? '') === 0) {
if (strcasecmp($absFilePath, Convert::slashes($compareFilePath ?? '')) === 0) {
$matchedClasses[$lowerClass] = $classNames[$lowerClass];
}
}
@ -324,14 +324,14 @@ class ClassInfo
*/
public static function classes_for_folder($folderPath)
{
$absFolderPath = Director::getAbsFile($folderPath);
$absFolderPath = Convert::slashes(Director::getAbsFile($folderPath));
$classManifest = ClassLoader::inst()->getManifest();
$classes = $classManifest->getClasses();
$classNames = $classManifest->getClassNames();
$matchedClasses = [];
foreach ($classes as $lowerClass => $compareFilePath) {
if (stripos($compareFilePath ?? '', $absFolderPath ?? '') === 0) {
if (stripos(Convert::slashes($compareFilePath ?? ''), $absFolderPath) === 0) {
$matchedClasses[$lowerClass] = $classNames[$lowerClass];
}
}