Created
August 9, 2020 00:27
-
-
Save mkmarineboy/0ff07a72a4ee2b228f910cce4f0394f9 to your computer and use it in GitHub Desktop.
Quick fix for QStringList list declaration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const QDir &PluginContainer::pluginDir() | |
{ | |
static bool isLoaded = false; | |
static QDir path; | |
if (!isLoaded) { | |
isLoaded = true; | |
QString appDir = qApp->applicationDirPath(); | |
QStringList list{}; | |
#ifdef Q_OS_MAC | |
if (appDir == QLatin1String("MacOS")) { | |
list << appDir; | |
QDir dir(appDir); | |
// Development convenience-hack | |
dir.cdUp(); | |
dir.cdUp(); | |
dir.cdUp(); | |
appDir = dir.absolutePath(); | |
} | |
#endif | |
const auto suffix = QStringLiteral("/libsnore" SNORE_SUFFIX); | |
list << appDir; | |
for (const QString &s : qApp->libraryPaths()) { | |
list << s + suffix; | |
} | |
list<< appDir + suffix | |
<< appDir + QStringLiteral("/../lib/plugins") + suffix | |
<< appDir + QStringLiteral("/../lib64/plugins") + suffix | |
<< QStringLiteral(LIBSNORE_PLUGIN_PATH); | |
qCDebug(SNORE) << "Plugin locations:" << list; | |
foreach(const QString & p, list) { | |
path = QDir(p); | |
if (!path.entryInfoList(pluginFileFilters()).isEmpty()) { | |
break; | |
} else { | |
qCDebug(SNORE) << "Possible pluginpath:" << path.absolutePath() << "does not contain plugins."; | |
} | |
} | |
if (path.entryInfoList(pluginFileFilters()).isEmpty()) { | |
qCWarning(SNORE) << "Couldnt find any plugins"; | |
} | |
qCDebug(SNORE) << "PluginPath is :" << path.absolutePath(); | |
} | |
return path; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment