Skip to content

Commit

Permalink
Fixed|Client|libdoomsday: Load plugins only from the /bin folder
Browse files Browse the repository at this point in the history
LibraryFiles elsewhere in the file tree should be ignored for now.
Fixed the naming of the Library_ForAll() function.
  • Loading branch information
skyjake committed Apr 1, 2016
1 parent 33f7450 commit 35d8f73
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion doomsday/apps/client/src/audio/audiodriver.cpp
Expand Up @@ -55,7 +55,7 @@ DENG2_PIMPL(AudioDriver)
if(!name.isEmpty())
{
LibraryFile *found = nullptr;
Library_forAll([&name, &found] (LibraryFile &lib)
Library_ForAll([&name, &found] (LibraryFile &lib)
{
// Plugins are native files.
if(lib.source()->is<NativeFile>())
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/libdoomsday/include/doomsday/library.h
Expand Up @@ -103,7 +103,7 @@ LIBDOOMSDAY_PUBLIC void *Library_Symbol(Library *lib, char const *symbolName);

LIBDOOMSDAY_PUBLIC de::LibraryFile &Library_File(Library *lib);

LIBDOOMSDAY_PUBLIC de::LoopResult Library_forAll(std::function<de::LoopResult (de::LibraryFile &)> func);
LIBDOOMSDAY_PUBLIC de::LoopResult Library_ForAll(std::function<de::LoopResult (de::LibraryFile &)> func);
#endif

#endif // LIBDOOMSDAY_LIBRARY_H
12 changes: 8 additions & 4 deletions doomsday/apps/libdoomsday/src/library.cpp
@@ -1,4 +1,4 @@
/** @file library.cpp Dynamic libraries.
/** @file library.cpp Dynamic libraries.
* @ingroup base
*
* @authors Copyright © 2006-2015 Jaakko Keränen <jaakko.keranen@iki.fi>
Expand Down Expand Up @@ -179,13 +179,17 @@ char const *Library_LastError()
return Str_Text(lastError);
}

de::LoopResult Library_forAll(std::function<de::LoopResult (de::LibraryFile &)> func)
de::LoopResult Library_ForAll(std::function<de::LoopResult (de::LibraryFile &)> func)
{
de::FS::Index const &libs = de::App::fileSystem().indexFor(DENG2_TYPE_NAME(de::LibraryFile));
DENG2_FOR_EACH_CONST(de::FS::Index, i, libs)
{
if(auto result = func(i->second->as<de::LibraryFile>()))
return result;
auto &libraryFile = i->second->as<de::LibraryFile>();
if(libraryFile.path().beginsWith("/bin/"))
{
if(auto result = func(libraryFile))
return result;
}
}
return de::LoopContinue;
}
2 changes: 1 addition & 1 deletion doomsday/apps/libdoomsday/src/plugins.cpp
Expand Up @@ -235,7 +235,7 @@ void Plugins::loadAll()
{
LOG_RES_VERBOSE("Initializing plugins...");

Library_forAll([this] (LibraryFile &lib)
Library_ForAll([this] (LibraryFile &lib)
{
return d->loadPlugin(lib);
});
Expand Down

0 comments on commit 35d8f73

Please sign in to comment.