Only loaded matching plugin on Mac #4866

Conflicts:
	src/lib/arch/unix/ArchPluginUnix.cpp
This commit is contained in:
Xinyu Hou 2015-07-16 02:24:33 +01:00 committed by Jerry (Xinyu Hou)
parent a249c38b96
commit a99699df7a
1 changed files with 15 additions and 5 deletions

View File

@ -19,6 +19,7 @@
#include "arch/unix/ArchPluginUnix.h" #include "arch/unix/ArchPluginUnix.h"
#include "arch/unix/XArchUnix.h" #include "arch/unix/XArchUnix.h"
#include "common/PluginVersion.h"
#include "base/IEventQueue.h" #include "base/IEventQueue.h"
#include "base/Event.h" #include "base/Event.h"
#include "base/Log.h" #include "base/Log.h"
@ -84,13 +85,22 @@ ArchPluginUnix::load()
String filename = synergy::string::removeFileExt(*it); String filename = synergy::string::removeFileExt(*it);
m_pluginTable.insert(std::make_pair(filename, library)); m_pluginTable.insert(std::make_pair(filename, library));
const char * version = (char*)invoke( filename.c_str(),"version",NULL); size_t pos = filename.find("lib");
if (version == NULL) { String pluginName = filename.substr(pos + 3);
version = kPre174Plugin; 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)); 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);
}
}
} }
void void