Commit b67e50d5 authored by Robert McGibbon's avatar Robert McGibbon
Browse files

Sort plugins by length of filename before loading

parent 7be6e8fb
......@@ -45,6 +45,7 @@
#include <cstdlib>
#endif
#include <set>
#include <algorithm>
#include "ReferencePlatform.h"
......@@ -52,6 +53,9 @@ using namespace OpenMM;
using namespace std;
std::vector<std::string> Platform::pluginLoadFailures;
static bool stringLengthComparator(string i, string j) {
return (i.size() < j.size());
}
static int registerPlatforms() {
......@@ -269,6 +273,7 @@ vector<string> Platform::loadPluginsFromDirectory(const string& directory) {
#endif
vector<string> loadedLibraries;
pluginLoadFailures.resize(0);
std::sort (files.begin(), files.end(), stringLengthComparator);
for (unsigned int i = 0; i < files.size(); ++i) {
try {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment