diff options
| author | Alexander Gavrilov | 2012-05-04 19:47:18 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-05-04 19:47:18 +0400 |
| commit | d4d6349f48d01b31f59f94238d6656e3b5d08508 (patch) | |
| tree | 43e47bbb5bab970825ff217ddbc16e21a3711033 /library/PluginManager.cpp | |
| parent | 5afe2ca0020404d46ad3de840030a7b9e186b059 (diff) | |
| download | dfhack-d4d6349f48d01b31f59f94238d6656e3b5d08508.tar.gz dfhack-d4d6349f48d01b31f59f94238d6656e3b5d08508.tar.bz2 dfhack-d4d6349f48d01b31f59f94238d6656e3b5d08508.tar.xz | |
Expose builtin commands to dfhack-run, and add lua script support.
Move builtin command implementation to Core methods, and fall
back to hack/scripts/*.lua for otherwise unrecognized commands.
Diffstat (limited to 'library/PluginManager.cpp')
| -rw-r--r-- | library/PluginManager.cpp | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/library/PluginManager.cpp b/library/PluginManager.cpp index 837c3e2d..69b8bfe0 100644 --- a/library/PluginManager.cpp +++ b/library/PluginManager.cpp @@ -45,41 +45,8 @@ using namespace std; #include "tinythread.h" using namespace tthread; -#ifdef LINUX_BUILD - #include <dirent.h> - #include <errno.h> -#else - #include "wdirent.h" -#endif - #include <assert.h> -static int getdir (string dir, vector<string> &files) -{ - DIR *dp; - struct dirent *dirp; - if((dp = opendir(dir.c_str())) == NULL) - { - return errno; - } - while ((dirp = readdir(dp)) != NULL) { - files.push_back(string(dirp->d_name)); - } - closedir(dp); - return 0; -} - -bool hasEnding (std::string const &fullString, std::string const &ending) -{ - if (fullString.length() > ending.length()) - { - return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending)); - } - else - { - return false; - } -} struct Plugin::RefLock { RefLock() @@ -563,10 +530,10 @@ void Plugin::push_function(lua_State *state, LuaFunction *fn) PluginManager::PluginManager(Core * core) { #ifdef LINUX_BUILD - string path = core->p->getPath() + "/hack/plugins/"; + string path = core->getHackPath() + "plugins/"; const string searchstr = ".plug.so"; #else - string path = core->p->getPath() + "\\hack\\plugins\\"; + string path = core->getHackPath() + "plugins\\"; const string searchstr = ".plug.dll"; #endif cmdlist_mutex = new mutex(); |
