Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tsoc
openmm
Commits
38f4aedb
Commit
38f4aedb
authored
Aug 01, 2019
by
Elizabeth
Browse files
Support for multiple paths in OPENMM_PLUGIN_DIR
parent
37d4b472
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
16 deletions
+28
-16
olla/include/openmm/Platform.h
olla/include/openmm/Platform.h
+1
-0
olla/src/Platform.cpp
olla/src/Platform.cpp
+27
-16
No files found.
olla/include/openmm/Platform.h
View file @
38f4aedb
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
#include <map>
#include <map>
#include <string>
#include <string>
#include <vector>
#include <vector>
#include <sstream>
#include "openmm/internal/windowsExport.h"
#include "openmm/internal/windowsExport.h"
namespace
OpenMM
{
namespace
OpenMM
{
...
...
olla/src/Platform.cpp
View file @
38f4aedb
...
@@ -261,31 +261,42 @@ void Platform::loadPluginLibrary(const string& file) {
...
@@ -261,31 +261,42 @@ void Platform::loadPluginLibrary(const string& file) {
vector
<
string
>
Platform
::
loadPluginsFromDirectory
(
const
string
&
directory
)
{
vector
<
string
>
Platform
::
loadPluginsFromDirectory
(
const
string
&
directory
)
{
vector
<
string
>
files
;
vector
<
string
>
files
;
char
dirSeparator
;
char
dirSeparator
;
char
pathSeparator
;
stringstream
sdirectory
(
directory
);
#ifdef WIN32
#ifdef WIN32
dirSeparator
=
'\\'
;
dirSeparator
=
'\\'
;
pathSeparator
=
';'
;
WIN32_FIND_DATA
fileInfo
;
WIN32_FIND_DATA
fileInfo
;
string
filePattern
(
directory
+
dirSeparator
+
"*.dll"
);
HANDLE
findHandle
=
FindFirstFile
(
filePattern
.
c_str
(),
&
fileInfo
);
for
(
string
path
;
std
::
getline
(
sdirectory
,
path
,
pathSeparator
);)
{
if
(
findHandle
!=
INVALID_HANDLE_VALUE
)
{
string
filePattern
(
path
+
dirSeparator
+
"*.dll"
);
do
{
HANDLE
findHandle
=
FindFirstFile
(
filePattern
.
c_str
(),
&
fileInfo
);
if
(
fileInfo
.
cFileName
[
0
]
!=
'.'
)
if
(
findHandle
!=
INVALID_HANDLE_VALUE
)
{
files
.
push_back
(
string
(
fileInfo
.
cFileName
));
do
{
}
while
(
FindNextFile
(
findHandle
,
&
fileInfo
));
if
(
fileInfo
.
cFileName
[
0
]
!=
'.'
)
FindClose
(
findHandle
);
files
.
push_back
(
path
+
dirSeparator
+
string
(
fileInfo
.
cFileName
));
}
while
(
FindNextFile
(
findHandle
,
&
fileInfo
));
FindClose
(
findHandle
);
}
}
}
vector
<
HMODULE
>
plugins
;
vector
<
HMODULE
>
plugins
;
#else
#else
dirSeparator
=
'/'
;
DIR
*
dir
;
DIR
*
dir
;
dirSeparator
=
'/'
;
pathSeparator
=
':'
;
struct
dirent
*
entry
;
struct
dirent
*
entry
;
dir
=
opendir
(
directory
.
c_str
());
if
(
dir
!=
NULL
)
{
for
(
string
path
;
std
::
getline
(
sdirectory
,
path
,
pathSeparator
);)
{
while
((
entry
=
readdir
(
dir
))
!=
NULL
)
{
dir
=
opendir
(
path
.
c_str
());
if
(
entry
->
d_name
[
0
]
!=
'.'
)
if
(
dir
!=
NULL
)
{
files
.
push_back
(
string
(
entry
->
d_name
));
while
((
entry
=
readdir
(
dir
))
!=
NULL
)
{
if
(
entry
->
d_name
[
0
]
!=
'.'
)
files
.
push_back
(
path
+
dirSeparator
+
string
(
entry
->
d_name
));
}
closedir
(
dir
);
}
}
closedir
(
dir
);
}
}
vector
<
void
*>
plugins
;
vector
<
void
*>
plugins
;
#endif
#endif
vector
<
string
>
loadedLibraries
;
vector
<
string
>
loadedLibraries
;
...
@@ -294,7 +305,7 @@ vector<string> Platform::loadPluginsFromDirectory(const string& directory) {
...
@@ -294,7 +305,7 @@ vector<string> Platform::loadPluginsFromDirectory(const string& directory) {
for
(
unsigned
int
i
=
0
;
i
<
files
.
size
();
++
i
)
{
for
(
unsigned
int
i
=
0
;
i
<
files
.
size
();
++
i
)
{
try
{
try
{
plugins
.
push_back
(
loadOneLibrary
(
directory
+
dirSeparator
+
files
[
i
]));
plugins
.
push_back
(
loadOneLibrary
(
files
[
i
]));
loadedLibraries
.
push_back
(
files
[
i
]);
loadedLibraries
.
push_back
(
files
[
i
]);
}
catch
(
OpenMMException
&
ex
)
{
}
catch
(
OpenMMException
&
ex
)
{
pluginLoadFailures
.
push_back
(
ex
.
what
());
pluginLoadFailures
.
push_back
(
ex
.
what
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment