Commit 47f2af23 authored by peastman's avatar peastman
Browse files

Merge pull request #997 from rmcgibbo/sort-order

Sort plugins by length of filename before loading
parents 071f2f81 b67e50d5
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <cstdlib> #include <cstdlib>
#endif #endif
#include <set> #include <set>
#include <algorithm>
#include "ReferencePlatform.h" #include "ReferencePlatform.h"
...@@ -52,6 +53,9 @@ using namespace OpenMM; ...@@ -52,6 +53,9 @@ using namespace OpenMM;
using namespace std; using namespace std;
std::vector<std::string> Platform::pluginLoadFailures; std::vector<std::string> Platform::pluginLoadFailures;
static bool stringLengthComparator(string i, string j) {
return (i.size() < j.size());
}
static int registerPlatforms() { static int registerPlatforms() {
...@@ -269,6 +273,7 @@ vector<string> Platform::loadPluginsFromDirectory(const string& directory) { ...@@ -269,6 +273,7 @@ vector<string> Platform::loadPluginsFromDirectory(const string& directory) {
#endif #endif
vector<string> loadedLibraries; vector<string> loadedLibraries;
pluginLoadFailures.resize(0); pluginLoadFailures.resize(0);
std::sort (files.begin(), files.end(), stringLengthComparator);
for (unsigned int i = 0; i < files.size(); ++i) { for (unsigned int i = 0; i < files.size(); ++i) {
try { 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