Replace manual library suffix check with QLibrary::isLibrary
This commit is contained in:
parent
d96b8646ce
commit
b8a6b47b29
@ -81,17 +81,9 @@ void MainWindow::loadPlugins() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::loadPluginDir(QString dir) {
|
void MainWindow::loadPluginDir(QString dir) {
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
constexpr auto libSuffix = ".dll";
|
|
||||||
#elif defined(Q_OS_MAC)
|
|
||||||
constexpr auto libSuffix = ".dylib";
|
|
||||||
#else
|
|
||||||
constexpr auto libSuffix = ".so";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (auto pluginPath : QDir(dir).entryList()) {
|
for (auto pluginPath : QDir(dir).entryList()) {
|
||||||
pluginPath = dir + '/' + pluginPath;
|
pluginPath = dir + '/' + pluginPath;
|
||||||
if (pluginPath.endsWith(libSuffix)) {
|
if (QLibrary::isLibrary(pluginPath)) {
|
||||||
loadPlugin(pluginPath);
|
loadPlugin(pluginPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user