MCPcopy Create free account
hub / github.com/KDE/kdevelop / getFileNames

Method getFileNames

plugins/qmljs/duchain/cache.cpp:115–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115QStringList QmlJS::Cache::getFileNames(const QFileInfoList& fileInfos)
116{
117 QStringList result;
118
119 for (const QFileInfo& fileInfo : fileInfos) {
120 QString filePath = fileInfo.canonicalFilePath();
121
122 // If the module directory contains a plugins.qmltypes files, use it
123 // and skip everything else
124 if (filePath.endsWith(QLatin1String("plugins.qmltypes"))) {
125 return QStringList() << filePath;
126 } else if (fileInfo.dir().exists(QStringLiteral("plugins.qmltypes"))) {
127 return {fileInfo.dir().filePath(QStringLiteral("plugins.qmltypes"))};
128 }
129
130 // Non-so files don't need any treatment
131 if (!filePath.endsWith(QLatin1String(".so"))) {
132 result.append(filePath);
133 continue;
134 }
135
136 // Use the cache to speed-up reparses
137 {
138 QMutexLocker lock(&m_mutex);
139
140 const auto modulePathIt = m_modulePaths.constFind(filePath);
141 if (modulePathIt != m_modulePaths.constEnd()) {
142 const QString& cachedFilePath = *modulePathIt;
143
144 if (!cachedFilePath.isEmpty()) {
145 result.append(cachedFilePath);
146 }
147
148 continue;
149 }
150 }
151
152 // Locate an existing dump of the file
153 QString dumpFile = QStringLiteral("kdevqmljssupport/%1.qml").arg(
154 QString::fromLatin1(QCryptographicHash::hash(filePath.toUtf8(), QCryptographicHash::Md5).toHex())
155 );
156 QString dumpPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
157 dumpFile
158 );
159
160 if (!dumpPath.isEmpty()) {
161 QMutexLocker lock(&m_mutex);
162
163 result.append(dumpPath);
164 m_modulePaths.insert(filePath, dumpPath);
165 continue;
166 }
167
168 // Create a dump of the file
169 const QStringList args = {QStringLiteral("-noinstantiate"), QStringLiteral("-path"), filePath};
170
171 for (const PluginDumpExecutable& executable : std::as_const(m_pluginDumpExecutables)) {
172 QProcess qmlplugindump;

Callers 1

importDirectoryMethod · 0.80

Calls 15

QStringListClass · 0.85
endsWithMethod · 0.80
existsMethod · 0.80
constEndMethod · 0.80
readLineMethod · 0.80
hashFunction · 0.70
filePathMethod · 0.45
appendMethod · 0.45
constFindMethod · 0.45
isEmptyMethod · 0.45
insertMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected