Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/profilemanager.cpp
Show First 20 Lines • Show All 310 Lines • ▼ Show 20 Line(s) | 306 | for (const QString &path : qAsConst(paths)) { | |||
---|---|---|---|---|---|
311 | } | 311 | } | ||
312 | } | 312 | } | ||
313 | return firmwares; | 313 | return firmwares; | ||
314 | } | 314 | } | ||
315 | 315 | | |||
316 | QStringList ProfileManager::firmwaresInPath(const QString &path) | 316 | QStringList ProfileManager::firmwaresInPath(const QString &path) | ||
317 | { | 317 | { | ||
318 | QStringList firmwares; | 318 | QStringList firmwares; | ||
319 | QStringList files = QDir(path).entryList(QDir::Files); | 319 | for (QString file : QDir(path).entryList({AtCoreDirectories::pluginExtFilter}, QDir::Files)) { | ||
320 | for (QString file : files) { | 320 | file = file.split(QStringLiteral(".")).at(0).toLower().simplified(); | ||
321 | #if defined(Q_OS_WIN) | | |||
322 | if (file.endsWith(QStringLiteral(".dll"))) | | |||
323 | #elif defined(Q_OS_MAC) | | |||
324 | if (file.endsWith(QStringLiteral(".dylib"))) | | |||
325 | #else | | |||
326 | if (file.endsWith(QStringLiteral(".so"))) | | |||
327 | #endif | | |||
328 | file = file.split(QChar::fromLatin1('.')).at(0); | | |||
329 | else { | | |||
330 | continue; | | |||
331 | } | | |||
332 | if (file.startsWith(QStringLiteral("lib"))) { | 321 | if (file.startsWith(QStringLiteral("lib"))) { | ||
333 | file = file.remove(QStringLiteral("lib")); | 322 | file = file.remove(QStringLiteral("lib")); | ||
334 | } | 323 | } | ||
335 | file = file.toLower().simplified(); | | |||
336 | firmwares.append(file); | 324 | firmwares.append(file); | ||
337 | } | 325 | } | ||
338 | return firmwares; | 326 | return firmwares; | ||
339 | } | 327 | } |