23 #include "casesensitivefsfileseeker.h" 
   25 #include "pathfinder/filesearchpath.h" 
   30 #include <QStringList> 
   32 CaseSensitiveFSFileSeeker::CaseSensitiveFSFileSeeker(QSharedPointer <QList<FileSearchPath> > paths) :
 
   37 QString CaseSensitiveFSFileSeeker::findFileInPath(
const QString &fileName, 
FileSearchPath &path)
 
   40                 generatePathCacheAndEditPaths(path);
 
   41         if (path.getCache().contains(fileName.toLower()))
 
   42                 return QDir(path.path()).absoluteFilePath(path.getCache().value(fileName.toLower()));
 
   46 void CaseSensitiveFSFileSeeker::generatePathCacheAndEditPaths(
FileSearchPath &path)
 
   48         QFileInfoList entriesDirectory = QDir(path.path()).entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot);
 
   49         QSet<QString> entriesDirAbsolutePath;
 
   50         QMap<QString, QString> entriesFileNames;
 
   52         for (
const QFileInfo &entry : entriesDirectory)
 
   55                         entriesFileNames.insert(entry.fileName().toLower(), entry.fileName());
 
   56                 else if (entry.isDir())
 
   57                         entriesDirAbsolutePath << entry.absoluteFilePath();
 
   60         if (path.isRecursive())
 
   62                 QList<FileSearchPath> subpaths;
 
   63                 for (
const QString &entry : entriesDirAbsolutePath)
 
   66                         subpath.setRecursive(
true);
 
   69                 insertSubpathsAfterPath(path, subpaths);
 
   70                 path.setRecursive(
false);
 
   75 void CaseSensitiveFSFileSeeker::insertSubpathsAfterPath(
const FileSearchPath &path, QList<FileSearchPath> subpaths)
 
   77         QList<FileSearchPath> postPathBaseEntries;
 
   78         while (!paths->isEmpty() && paths->last().path() != path.path())
 
   79                 postPathBaseEntries.prepend(paths->takeLast());
 
   80         *paths.data() << subpaths << postPathBaseEntries;