diff options
| author | Naios <naios-dev@live.de> | 2016-04-18 20:29:42 +0200 |
|---|---|---|
| committer | Naios <naios-dev@live.de> | 2016-04-18 23:03:24 +0200 |
| commit | 51ec8d3b8cc6d2691b4a9c0d4502fd1936d82c79 (patch) | |
| tree | 61667f6e4bc15ad98e171bc224721d3f859bd0e1 /src/common | |
| parent | 2809f11839ff0fd4eec45b2e116811b0698dd05b (diff) | |
Core/Scripting: Use the path of the worldserver executable to search for the scripts dir
* Fixes issues when starting the worldserver not in the bin directory
or the CMAKE_INSTALL_PREFIX directory using the -c option.
(cherry picked from commit 86b0fcf67aadc0d313253befb0590d00efd085bc)
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/Configuration/Config.cpp | 6 | ||||
| -rw-r--r-- | src/common/Configuration/Config.h | 8 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/common/Configuration/Config.cpp b/src/common/Configuration/Config.cpp index 1f340b38e42..fb2ba333cfa 100644 --- a/src/common/Configuration/Config.cpp +++ b/src/common/Configuration/Config.cpp @@ -26,11 +26,13 @@ using namespace boost::property_tree; -bool ConfigMgr::LoadInitial(std::string const& file, std::string& error) +bool ConfigMgr::LoadInitial(std::string const& file, std::vector<std::string> args, + std::string& error) { std::lock_guard<std::mutex> lock(_configLock); _filename = file; + _args = args; try { @@ -66,7 +68,7 @@ ConfigMgr* ConfigMgr::instance() bool ConfigMgr::Reload(std::string& error) { - return LoadInitial(_filename, error); + return LoadInitial(_filename, std::move(_args), error); } template<class T> diff --git a/src/common/Configuration/Config.h b/src/common/Configuration/Config.h index 7f5b3c11d2d..1eccea6ee54 100644 --- a/src/common/Configuration/Config.h +++ b/src/common/Configuration/Config.h @@ -23,6 +23,7 @@ #include <string> #include <list> +#include <vector> #include <mutex> #include <boost/property_tree/ptree.hpp> @@ -34,8 +35,9 @@ class TC_COMMON_API ConfigMgr ~ConfigMgr() = default; public: - /// Method used only for loading main configuration files - bool LoadInitial(std::string const& file, std::string& error); + /// Method used only for loading main configuration files (bnetserver.conf and worldserver.conf) + bool LoadInitial(std::string const& file, std::vector<std::string> args, + std::string& error); static ConfigMgr* instance(); @@ -47,10 +49,12 @@ public: float GetFloatDefault(std::string const& name, float def) const; std::string const& GetFilename(); + std::vector<std::string> const& GetArguments() const { return _args; } std::list<std::string> GetKeysByString(std::string const& name); private: std::string _filename; + std::vector<std::string> _args; boost::property_tree::ptree _config; std::mutex _configLock; |
