Skip to content

Commit

Permalink
Refactor|libdeng: Converted the library module to C++
Browse files Browse the repository at this point in the history
Locating shared libraries will be soon done via de::FS on all platforms.
Removed the unnecessary Library_AddSearchDir() function, as the de::App
will take care of the search locations.
  • Loading branch information
skyjake committed Oct 14, 2012
1 parent e4eb4c4 commit 9d0af78
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion doomsday/engine/engine.pro
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ SOURCES += \
portable/src/json.cpp \
portable/src/kdtree.c \
portable/src/keycode.cpp \
portable/src/library.c \
portable/src/library.cpp \
portable/src/linedef.c \
portable/src/lumpfile.cpp \
portable/src/lumpindex.cpp \
Expand Down
5 changes: 0 additions & 5 deletions doomsday/engine/portable/include/library.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ void Library_Shutdown(void);
*/
void Library_ReleaseGames(void);

/**
* Defines an additional library @a dir where to look for dynamic libraries.
*/
void Library_AddSearchDir(const char* dir);

/**
* Looks for dynamic libraries and calls @a func for each one.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @file library.c
* Dynamic libraries implementation. @ingroup base
* @file library.cpp
* Dynamic libraries. @ingroup base
*
* @authors Copyright © 2006-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2009-2012 Daniel Swanson <danij@dengine.net>
Expand Down Expand Up @@ -34,6 +34,8 @@
#include "de_filesys.h"
#include "m_misc.h"

#include <de/App>

#ifdef WIN32
# include "de_platform.h"
#endif
Expand Down Expand Up @@ -233,7 +235,7 @@ Library* Library_New(const char *fileName)
#endif

// Create the Library instance.
lib = calloc(1, sizeof(*lib));
lib = (Library*) calloc(1, sizeof(*lib));
lib->handle = handle;
lib->path = Str_NewStd();
#ifdef UNIX
Expand Down Expand Up @@ -301,17 +303,14 @@ const char* Library_LastError(void)
return Str_Text(lastError);
}

void Library_AddSearchDir(const char *dir)
{
/// @todo Implement this (and use it in the lookup)
}

#ifdef UNIX
static boolean isPossiblyLibraryFile(const char* path, const struct dirent* entry)
{
if(!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")) return false;

#ifdef MACOSX
DENG_UNUSED(path);

// Mac plugins are bundled in a subdir.
if(entry->d_type != DT_REG &&
entry->d_type != DT_DIR &&
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/unix/src/dd_uinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ static int initPluginSystem(void)
{
#ifdef DENG_LIBRARY_DIR
// The default directory is defined in the Makefile. For instance, "/usr/local/lib".
Library_AddSearchDir(DENG_LIBRARY_DIR);
//Library_AddSearchDir(DENG_LIBRARY_DIR);
#endif
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/libdeng2/src/filesys/libraryfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ bool LibraryFile::recognize(const File& file)
const NativeFile* native = dynamic_cast<const NativeFile*>(&file);
if(native)
{
String parentFolderName = native->nativePath().fileNamePath().fileName();
if(QLibrary::isLibrary(parentFolderName))
// Check if the parent folder is a bundle.
if(QLibrary::isLibrary(native->nativePath().fileNamePath().fileName()))
{
return true;
}
Expand Down

0 comments on commit 9d0af78

Please sign in to comment.