aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2008-09-30 16:34:38 +0000
committerMax Horn2008-09-30 16:34:38 +0000
commit73b833042e55959954d78b3e6aa2cc89c5b8848d (patch)
tree6084627a0c643a514186b2cbef439b971c322e22
parent1d7de023d938078767a7c5b478769d5a4f308721 (diff)
downloadscummvm-rg350-73b833042e55959954d78b3e6aa2cc89c5b8848d.tar.gz
scummvm-rg350-73b833042e55959954d78b3e6aa2cc89c5b8848d.tar.bz2
scummvm-rg350-73b833042e55959954d78b3e6aa2cc89c5b8848d.zip
Modified FilePluginProvider to use FSNodes (instead of raw filenames / paths) in its API
svn-id: r34709
-rw-r--r--backends/plugins/dc/dc-provider.cpp8
-rw-r--r--backends/plugins/dc/dc-provider.h4
-rw-r--r--backends/plugins/posix/posix-provider.cpp5
-rw-r--r--backends/plugins/posix/posix-provider.h2
-rw-r--r--backends/plugins/sdl/sdl-provider.cpp5
-rw-r--r--backends/plugins/sdl/sdl-provider.h2
-rw-r--r--backends/plugins/win32/win32-provider.cpp8
-rw-r--r--backends/plugins/win32/win32-provider.h4
-rw-r--r--base/plugins.cpp8
-rw-r--r--base/plugins.h13
10 files changed, 34 insertions, 25 deletions
diff --git a/backends/plugins/dc/dc-provider.cpp b/backends/plugins/dc/dc-provider.cpp
index 9b150c8db4..742683d7fb 100644
--- a/backends/plugins/dc/dc-provider.cpp
+++ b/backends/plugins/dc/dc-provider.cpp
@@ -27,6 +27,7 @@
#include "backends/plugins/dc/dc-provider.h"
#include "backends/plugins/dynamic-plugin.h"
+#include "common/fs.h"
#include "dcloader.h"
@@ -83,12 +84,13 @@ public:
};
-Plugin* DCPluginProvider::createPlugin(const Common::String &filename) const {
- return new DCPlugin(filename);
+Plugin* DCPluginProvider::createPlugin(const Common::FilesystemNode &node) const {
+ return new DCPlugin(node.getPath());
}
-bool DCPluginProvider::isPluginFilename(const Common::String &filename) const {
+bool DCPluginProvider::isPluginFilename(const Common::FilesystemNode &node) const {
// Check the plugin suffix
+ Common::String filename = node.getName();
if (!filename.hasSuffix(".PLG"))
return false;
diff --git a/backends/plugins/dc/dc-provider.h b/backends/plugins/dc/dc-provider.h
index f413061828..7a204698b8 100644
--- a/backends/plugins/dc/dc-provider.h
+++ b/backends/plugins/dc/dc-provider.h
@@ -32,9 +32,9 @@
class DCPluginProvider : public FilePluginProvider {
protected:
- Plugin* createPlugin(const Common::String &filename) const;
+ Plugin* createPlugin(const Common::FilesystemNode &node) const;
- bool isPluginFilename(const Common::String &filename) const;
+ bool isPluginFilename(const Common::FilesystemNode &node) const;
virtual void addCustomDirectories(Common::StringList &dirs) const {
dirs.push_back("/");
diff --git a/backends/plugins/posix/posix-provider.cpp b/backends/plugins/posix/posix-provider.cpp
index 39847e53bf..ec67e5768a 100644
--- a/backends/plugins/posix/posix-provider.cpp
+++ b/backends/plugins/posix/posix-provider.cpp
@@ -27,6 +27,7 @@
#include "backends/plugins/posix/posix-provider.h"
#include "backends/plugins/dynamic-plugin.h"
+#include "common/fs.h"
#include <dlfcn.h>
@@ -78,8 +79,8 @@ public:
};
-Plugin* POSIXPluginProvider::createPlugin(const Common::String &filename) const {
- return new POSIXPlugin(filename);
+Plugin* POSIXPluginProvider::createPlugin(const Common::FilesystemNode &node) const {
+ return new POSIXPlugin(node.getPath());
}
diff --git a/backends/plugins/posix/posix-provider.h b/backends/plugins/posix/posix-provider.h
index 40c16b3e11..6cdc0f44d4 100644
--- a/backends/plugins/posix/posix-provider.h
+++ b/backends/plugins/posix/posix-provider.h
@@ -32,7 +32,7 @@
class POSIXPluginProvider : public FilePluginProvider {
protected:
- Plugin* createPlugin(const Common::String &filename) const;
+ Plugin* createPlugin(const Common::FilesystemNode &node) const;
};
#endif // defined(DYNAMIC_MODULES) && defined(UNIX)
diff --git a/backends/plugins/sdl/sdl-provider.cpp b/backends/plugins/sdl/sdl-provider.cpp
index 6df1dec680..221292e2dd 100644
--- a/backends/plugins/sdl/sdl-provider.cpp
+++ b/backends/plugins/sdl/sdl-provider.cpp
@@ -27,6 +27,7 @@
#include "backends/plugins/sdl/sdl-provider.h"
#include "backends/plugins/dynamic-plugin.h"
+#include "common/fs.h"
#include "SDL.h"
#include "SDL_loadso.h"
@@ -78,8 +79,8 @@ public:
};
-Plugin* SDLPluginProvider::createPlugin(const Common::String &filename) const {
- return new SDLPlugin(filename);
+Plugin* SDLPluginProvider::createPlugin(const Common::FilesystemNode &node) const {
+ return new SDLPlugin(node.getPath());
}
diff --git a/backends/plugins/sdl/sdl-provider.h b/backends/plugins/sdl/sdl-provider.h
index a9ec657e33..27fb446146 100644
--- a/backends/plugins/sdl/sdl-provider.h
+++ b/backends/plugins/sdl/sdl-provider.h
@@ -32,7 +32,7 @@
class SDLPluginProvider : public FilePluginProvider {
protected:
- Plugin* createPlugin(const Common::String &filename) const;
+ Plugin* createPlugin(const Common::FilesystemNode &node) const;
};
#endif // defined(DYNAMIC_MODULES) && defined(UNIX)
diff --git a/backends/plugins/win32/win32-provider.cpp b/backends/plugins/win32/win32-provider.cpp
index b8fdd3d802..0309d306af 100644
--- a/backends/plugins/win32/win32-provider.cpp
+++ b/backends/plugins/win32/win32-provider.cpp
@@ -27,6 +27,7 @@
#include "backends/plugins/win32/win32-provider.h"
#include "backends/plugins/dynamic-plugin.h"
+#include "common/fs.h"
#include <windows.h>
@@ -96,12 +97,13 @@ public:
};
-Plugin* Win32PluginProvider::createPlugin(const Common::String &filename) const {
- return new Win32Plugin(filename);
+Plugin* Win32PluginProvider::createPlugin(const Common::FilesystemNode &node) const {
+ return new Win32Plugin(node.getPath());
}
-bool Win32PluginProvider::isPluginFilename(const Common::String &filename) const {
+bool Win32PluginProvider::isPluginFilename(const Common::FilesystemNode &node) const {
// Check the plugin suffix
+ Common::String filename = node.getName();
if (!filename.hasSuffix(".dll"))
return false;
diff --git a/backends/plugins/win32/win32-provider.h b/backends/plugins/win32/win32-provider.h
index 4ddc8b7500..1a14c15c14 100644
--- a/backends/plugins/win32/win32-provider.h
+++ b/backends/plugins/win32/win32-provider.h
@@ -32,9 +32,9 @@
class Win32PluginProvider : public FilePluginProvider {
protected:
- Plugin* createPlugin(const Common::String &filename) const;
+ Plugin* createPlugin(const Common::FilesystemNode &node) const;
- bool isPluginFilename(const Common::String &filename) const;
+ bool isPluginFilename(const Common::FilesystemNode &node) const;
virtual void addCustomDirectories(Common::StringList &dirs) const {}
};
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 7b372587a1..7af758754b 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -231,8 +231,8 @@ PluginList FilePluginProvider::getPlugins() {
}
for (Common::FSList::const_iterator i = files.begin(); i != files.end(); ++i) {
- if (isPluginFilename(i->getName())) {
- pl.push_back(createPlugin(i->getPath()));
+ if (isPluginFilename(*i)) {
+ pl.push_back(createPlugin(*i));
}
}
}
@@ -240,7 +240,9 @@ PluginList FilePluginProvider::getPlugins() {
return pl;
}
-bool FilePluginProvider::isPluginFilename(const Common::String &filename) const {
+bool FilePluginProvider::isPluginFilename(const Common::FilesystemNode &node) const {
+ Common::String filename = node.getName();
+
#ifdef PLUGIN_PREFIX
// Check the plugin prefix
if (!filename.hasPrefix(PLUGIN_PREFIX))
diff --git a/base/plugins.h b/base/plugins.h
index 90c4469e4d..10fbc7d5e0 100644
--- a/base/plugins.h
+++ b/base/plugins.h
@@ -32,6 +32,7 @@
namespace Common {
class FSList;
+ class FilesystemNode;
}
@@ -238,19 +239,19 @@ protected:
* Subclasses of FilePluginProvider have to at least overload this method.
* If the file is not found, or does not contain loadable code, 0 is returned instead.
*
- * @param filename the name of the loadable code module
+ * @param node the FSNode of the loadable code module
* @return a pointer to a Plugin instance, or 0 if an error occurred.
*/
- virtual Plugin *createPlugin(const Common::String &filename) const = 0;
+ virtual Plugin *createPlugin(const Common::FilesystemNode &node) const = 0;
/**
- * Check if the supplied filename corresponds to a loadable plugin file in
- * the current platform.
+ * Check if the supplied file corresponds to a loadable plugin file in
+ * the current platform. Usually, this will just check the file name.
*
- * @param filename the name of the file to check
+ * @param node the FSNode of the file to check
* @return true if the filename corresponds to a plugin, false otherwise
*/
- virtual bool isPluginFilename(const Common::String &filename) const;
+ virtual bool isPluginFilename(const Common::FilesystemNode &node) const;
/**
* Optionally add to the list of directories to be searched for