From 25fd437d120dcd08144e86a5ebe7dc42c2e82a13 Mon Sep 17 00:00:00 2001
From: Jigal van Hemert <jigal.van.hemert@typo3.org>
Date: Tue, 22 Aug 2017 08:53:55 +0200
Subject: [PATCH] [BUGFIX] Extension Scanner finds files on Windows

The extension scanner now also works on windows, as
the paths have been fixed to contain only one type of
slashes.

Change-Id: I9859f28029931f19f06873145e1de572fbb8bdfa
Resolves: #82153
Releases: master
Reviewed-on: https://review.typo3.org/53763
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
---
 .../Classes/Controller/Action/Ajax/ExtensionScannerFiles.php    | 2 +-
 .../Action/Ajax/ExtensionScannerMarkFullyScannedRestFiles.php   | 2 +-
 .../Classes/Controller/Action/Ajax/ExtensionScannerScanFile.php | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionScannerFiles.php b/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionScannerFiles.php
index f6c532134771..e460b02a88c2 100644
--- a/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionScannerFiles.php
+++ b/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionScannerFiles.php
@@ -54,7 +54,7 @@ class ExtensionScannerFiles extends AbstractAjaxAction
         $relativeFileNames = [];
         foreach ($files as $file) {
             /** @var $file SplFileInfo */
-            $relativeFileNames[] = $file->getRelativePathname();
+            $relativeFileNames[] = GeneralUtility::fixWindowsFilePath($file->getRelativePathname());
         }
 
         $this->view->assignMultiple([
diff --git a/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionScannerMarkFullyScannedRestFiles.php b/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionScannerMarkFullyScannedRestFiles.php
index 6d86966188a5..be5f41350fd6 100644
--- a/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionScannerMarkFullyScannedRestFiles.php
+++ b/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionScannerMarkFullyScannedRestFiles.php
@@ -57,7 +57,7 @@ class ExtensionScannerMarkFullyScannedRestFiles extends AbstractAjaxAction
             }
 
             // Build array of file (hashes) not affected by current scan, if they are tagged as "FullyScanned"
-            $parsedRestFile = array_pop($documentationFile->getListEntry(realpath($restFile->getPathname())));
+            $parsedRestFile = array_pop($documentationFile->getListEntry(strtr(realpath($restFile->getPathname()), '\\', '/')));
             if (!in_array($parsedRestFile['file_hash'], $foundRestFileHashes, true)
                 && in_array('FullyScanned', $parsedRestFile['tags'], true)
             ) {
diff --git a/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionScannerScanFile.php b/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionScannerScanFile.php
index 09120f6a8e0f..2f8f39909d4d 100644
--- a/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionScannerScanFile.php
+++ b/typo3/sysext/install/Classes/Controller/Action/Ajax/ExtensionScannerScanFile.php
@@ -201,7 +201,7 @@ class ExtensionScannerScanFile extends AbstractAjaxAction
                     $restFileLocation = $restFile->getPathname();
                     break;
                 }
-                $parsedRestFile = array_pop($documentationFile->getListEntry(realpath($restFileLocation)));
+                $parsedRestFile = array_pop($documentationFile->getListEntry(strtr(realpath($restFileLocation), '\\', '/')));
                 $version = GeneralUtility::trimExplode('/', $restFileLocation);
                 array_pop($version);
                 // something like "8.2" .. "8.7" .. "master"
-- 
GitLab