MCPcopy Create free account
hub / github.com/Tencent/libpag / getAeVersionForPath

Method getAeVersionForPath

viewer/src/platform/win/PluginInstaller.cpp:284–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282}
283
284int PluginInstaller::getAeVersionForPath(const QString& aePath) const {
285 const QStringList registryPaths = {"HKEY_LOCAL_MACHINE\\SOFTWARE\\Adobe",
286 "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Adobe",
287 "HKEY_CURRENT_USER\\SOFTWARE\\Adobe"};
288
289 for (const QString& regPath : registryPaths) {
290 QSettings registry(regPath, QSettings::NativeFormat);
291 const QStringList adobeKeys = registry.childGroups();
292
293 for (const QString& key : adobeKeys) {
294 if (key.contains("After Effects", Qt::CaseInsensitive)) {
295 QSettings aeRegistry(regPath + "\\" + key, QSettings::NativeFormat);
296 QString installPath = aeRegistry.value("InstallPath").toString();
297 if (!installPath.isEmpty()) {
298 QString supportFilesPath = QDir::cleanPath(installPath + "/Support Files");
299 if (supportFilesPath == aePath) {
300 QRegularExpression versionRegex("After Effects(?: CC)? (\\d+)");
301 QRegularExpressionMatch match = versionRegex.match(key);
302 if (match.hasMatch()) {
303 return match.captured(1).toInt();
304 }
305 }
306 }
307 }
308 }
309 }
310
311 QSettings ccRegistry(
312 "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
313 QSettings::NativeFormat);
314 const QStringList uninstallKeys = ccRegistry.childGroups();
315
316 for (const QString& key : uninstallKeys) {
317 QSettings appRegistry(
318 "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + key,
319 QSettings::NativeFormat);
320 QString displayName = appRegistry.value("DisplayName").toString();
321 if (displayName.contains("Adobe After Effects", Qt::CaseInsensitive)) {
322 QString installLocation = appRegistry.value("InstallLocation").toString();
323 if (!installLocation.isEmpty()) {
324 QString supportFilesPath = QDir::cleanPath(installLocation + "/Support Files");
325 if (supportFilesPath == aePath) {
326 QRegularExpression versionRegex("After Effects(?: CC)? (\\d+)");
327 QRegularExpressionMatch match = versionRegex.match(displayName);
328 if (match.hasMatch()) {
329 return match.captured(1).toInt();
330 }
331 }
332 }
333 }
334 }
335
336 return 0;
337}
338
339bool PluginInstaller::executeWithPrivileges(const QString& command) const {
340 QTemporaryFile tempFile;

Callers

nothing calls this directly

Calls 4

toStringMethod · 0.80
valueMethod · 0.80
containsMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected