Only loaded matching plugin on Mac #4866
Conflicts: src/lib/arch/unix/ArchPluginUnix.cpp
This commit is contained in:
parent
a249c38b96
commit
a99699df7a
|
@ -19,6 +19,7 @@
|
|||
#include "arch/unix/ArchPluginUnix.h"
|
||||
|
||||
#include "arch/unix/XArchUnix.h"
|
||||
#include "common/PluginVersion.h"
|
||||
#include "base/IEventQueue.h"
|
||||
#include "base/Event.h"
|
||||
#include "base/Log.h"
|
||||
|
@ -84,12 +85,21 @@ ArchPluginUnix::load()
|
|||
String filename = synergy::string::removeFileExt(*it);
|
||||
m_pluginTable.insert(std::make_pair(filename, library));
|
||||
|
||||
const char * version = (char*)invoke( filename.c_str(),"version",NULL);
|
||||
if (version == NULL) {
|
||||
version = kPre174Plugin;
|
||||
size_t pos = filename.find("lib");
|
||||
String pluginName = filename.substr(pos + 3);
|
||||
char* version = (char*)invoke(filename.c_str(), "version", NULL);
|
||||
String expectedVersion(pluginVersion(pluginName.c_str()));
|
||||
if (version != NULL && expectedVersion.compare(version) == 0) {
|
||||
LOG((CLOG_DEBUG "loaded plugin: %s (%s)", (*it).c_str(), version));
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_WARN "plugin version doesn't match"));
|
||||
LOG((CLOG_DEBUG "expected plugin version: %s actual plugin version: %s",
|
||||
expectedVersion.c_str(), version));
|
||||
LOG((CLOG_WARN "skip plugin: %s", (*it).c_str()));
|
||||
m_pluginTable.erase(filename);
|
||||
dlclose(library);
|
||||
}
|
||||
|
||||
LOG((CLOG_DEBUG "loaded plugin: %s (%s)", (*it).c_str(),version));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue