From f54345e4fc889471513cba99151a5e6a2dcef2d8 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sat, 10 Oct 2015 23:25:14 +0800 Subject: This fixed yesterday's problem... In fact there was no object slicing, but it was due to my laziness... I reused the code from BLR2 in bullet.hpp and there was no inheritance in BLR2... Also start the implementation of the plugin system. --- src/plugin/pluginmgr.hpp | 15 +++++++++++++++ src/plugin/pluginmgr_dl.cpp | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/plugin/pluginmgr.hpp create mode 100644 src/plugin/pluginmgr_dl.cpp (limited to 'src/plugin') diff --git a/src/plugin/pluginmgr.hpp b/src/plugin/pluginmgr.hpp new file mode 100644 index 0000000..e3220c1 --- /dev/null +++ b/src/plugin/pluginmgr.hpp @@ -0,0 +1,15 @@ +#ifndef PLUGINMGR_H +#define PLUGINMGR_H +class pluginManager +{ +private: + char fn[256][256]; + int fcnt; + char pluginFolder[256]; +public: + pluginManager(); + void scanPlugin(); + void loadPlugin(const char* filename); +}; +#endif + diff --git a/src/plugin/pluginmgr_dl.cpp b/src/plugin/pluginmgr_dl.cpp new file mode 100644 index 0000000..f3ab816 --- /dev/null +++ b/src/plugin/pluginmgr_dl.cpp @@ -0,0 +1,20 @@ +#include +#include +#include "pluginmgr.hpp" +pluginManager::pluginManager() +{ + pluginFolder="./plugins"; +} +void pluginManager::scanPlugin() +{ + DIR *dir; + struct dirent *file; + if(dir=opendir(pluginFolder)) + { + while(file=readdir(dir)) + //puts(file->d_name); + if(strcmp(file->d_name+strlen(file->d_name)-3,".so")==0) + strcpy(fn[fcnt++],file->d_name); + closedir(dir); + } +} -- cgit v1.2.3