MCPcopy Create free account
hub / github.com/baldurk/renderdoc / GetInstalledExtensions

Method GetInstalledExtensions

qrenderdoc/Code/CaptureContext.cpp:302–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300}
301
302rdcarray<ExtensionMetadata> CaptureContext::GetInstalledExtensions()
303{
304 rdcarray<ExtensionMetadata> ret;
305
306 for(QString extensionFolder : PythonContext::GetApplicationExtensionsPaths())
307 {
308 QDirIterator it(extensionFolder, QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
309
310 while(it.hasNext())
311 {
312 QFileInfo fileinfo(it.next());
313
314 if(fileinfo.fileName().toLower() == lit("extension.json"))
315 {
316 QFile f(fileinfo.absoluteFilePath());
317
318 QString package = fileinfo.absolutePath()
319 .replace(extensionFolder, QString())
320 .replace(QLatin1Char('/'), QLatin1Char('.'));
321
322 while(package[0] == QLatin1Char('.'))
323 package.remove(0, 1);
324
325 while(package[package.size() - 1] == QLatin1Char('.'))
326 package.remove(package.size() - 1, 1);
327
328 if(f.exists() && f.open(QIODevice::ReadOnly | QIODevice::Text))
329 {
330 QVariantMap json = JSONToVariant(QString::fromUtf8(f.readAll()));
331
332 if(json.empty())
333 {
334 qCritical() << fileinfo.absoluteFilePath() << "is corrupt, cannot parse json";
335 continue;
336 }
337
338 ExtensionMetadata ext;
339
340 ext.package = package;
341 ext.filePath = fileinfo.absolutePath();
342
343 if(json.contains(lit("name")))
344 {
345 ext.name = json[lit("name")].toString();
346 }
347 else
348 {
349 qCritical() << "Extension" << package << "is corrupt, no name entry";
350 continue;
351 }
352
353 ext.extensionAPI = 1;
354 if(json.contains(lit("extension_api")))
355 {
356 ext.extensionAPI = json[lit("extension_api")].toInt();
357 }
358 else
359 {

Callers

nothing calls this directly

Calls 15

QLatin1CharClass · 0.85
JSONToVariantFunction · 0.85
hasNextMethod · 0.80
toLowerMethod · 0.80
fileNameMethod · 0.80
existsMethod · 0.80
QStringFunction · 0.50
fromUtf8Function · 0.50
nextMethod · 0.45
replaceMethod · 0.45
removeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected