[Server] Use old style of Server Plugins location

new-script-api
Koncord 7 years ago
parent ce6a4e4032
commit 4530370e52

@ -438,7 +438,7 @@ vector<vector<ServerPluginInfo>::iterator> loadOrderSolver(vector<ServerPluginIn
return move(result); return move(result);
} }
void LuaState::loadMods(std::vector<std::string> *list) void LuaState::loadMods(const std::string &modDir, std::vector<std::string> *list)
{ {
using namespace boost::filesystem; using namespace boost::filesystem;
@ -480,26 +480,15 @@ void LuaState::loadMods(std::vector<std::string> *list)
#endif #endif
path envServerDir = std::getenv("TES3MP_SERVER_DIR"); path envServerDir = modDir;
const char *envServerUserDir = std::getenv("TES3MP_SERVER_USERDIR");
if (envServerDir.empty()) if (envServerDir.empty())
{
envServerDir = current_path(); envServerDir = current_path();
setenv("TES3MP_SERVER_DIR", envServerDir.string().c_str(), 1);
}
addGlobalPackagePath(envServerDir.string() + "/lib/lua/?/init.lua;" + envServerDir.string() + "/lib/lua/?.lua"); addGlobalPackagePath(envServerDir.string() + "/lib/lua/?/init.lua;" + envServerDir.string() + "/lib/lua/?.lua");
addGlobalCPath(envServerDir.string() + "lib/?" + libExt); addGlobalCPath(envServerDir.string() + "lib/?" + libExt);
readConfig(envServerDir); readConfig(envServerDir);
if (envServerUserDir != nullptr)
{
readConfig(envServerUserDir);
addGlobalPackagePath(string(envServerUserDir) + "/lib/lua/?/init.lua;" + string(envServerUserDir) + "/lib/lua/?.lua");
}
vector<vector<ServerPluginInfo>::iterator> sortedPluginList; vector<vector<ServerPluginInfo>::iterator> sortedPluginList;
if (list != nullptr && !list->empty()) // manual sorted list if (list != nullptr && !list->empty()) // manual sorted list
{ {

@ -36,7 +36,7 @@ public:
void addGlobalCPath(const std::string &path); void addGlobalCPath(const std::string &path);
sol::table getCoreTable() { return dataEnv["Core"]; } sol::table getCoreTable() { return dataEnv["Core"]; }
sol::environment &getDataEnv(){ return dataEnv; } sol::environment &getDataEnv(){ return dataEnv; }
void loadMods(std::vector<std::string> *list = nullptr); void loadMods(const std::string &path, std::vector<std::string> *list = nullptr);
CommandController &getCmdCtrl(); CommandController &getCmdCtrl();
EventController &getEventCtrl(); EventController &getEventCtrl();

@ -191,11 +191,6 @@ int main(int argc, char *argv[])
string passw = mgr.getString("password", "General"); string passw = mgr.getString("password", "General");
string plugin_home = mgr.getString("home", "Plugins");
string moddir = Utils::convertPath(plugin_home + "/data");
vector<string> plugins (Utils::split(mgr.getString("plugins", "Plugins"), ','));
Utils::printVersion("TES3MP dedicated server", TES3MP_VERSION, version.mCommitHash, TES3MP_PROTO_VERSION); Utils::printVersion("TES3MP dedicated server", TES3MP_VERSION, version.mCommitHash, TES3MP_PROTO_VERSION);
int code; int code;
@ -246,10 +241,10 @@ int main(int argc, char *argv[])
Networking networking(peer); Networking networking(peer);
string plugin_home = mgr.getString("home", "Plugins");
if (mgr.getBool("autoSort", "Plugins")) if (mgr.getBool("autoSort", "Plugins"))
networking.getState().loadMods(); networking.getState().loadMods(plugin_home);
else else
{ {
std::vector<std::string> list; std::vector<std::string> list;
@ -261,7 +256,7 @@ int main(int argc, char *argv[])
} }
catch (...) {} // Manager::getString throws runtime_error exception if setting is not exist catch (...) {} // Manager::getString throws runtime_error exception if setting is not exist
networking.getState().loadMods(&list); networking.getState().loadMods(plugin_home, &list);
} }

Loading…
Cancel
Save