mirror of
https://github.com/telegramcores/mod-premium.git
synced 2026-01-13 00:58:36 +00:00
Merge pull request #9 from azerothcore/updateconfload
Update conf loading to support *nix and windows.
This commit is contained in:
@@ -331,12 +331,35 @@ public:
|
||||
|
||||
void OnBeforeConfigLoad(bool reload) override
|
||||
{
|
||||
if (!reload) {
|
||||
std::string cfg_file = "premium.conf";
|
||||
if (!reload)
|
||||
{
|
||||
std::string conf_path = _CONF_DIR;
|
||||
std::string cfg_file = conf_path + "/premium.conf";
|
||||
|
||||
#if PLATFORM == PLATFORM_WINDOWS
|
||||
cfg_file = "my_custom.conf";
|
||||
#endif
|
||||
std::string cfg_def_file = cfg_file + ".dist";
|
||||
|
||||
sConfigMgr->LoadMore(cfg_def_file.c_str());
|
||||
sConfigMgr->LoadMore(cfg_file.c_str());
|
||||
|
||||
// Load .conf.dist config
|
||||
if (!sConfigMgr->LoadMore(cfg_def_file.c_str()))
|
||||
{
|
||||
sLog->outString();
|
||||
sLog->outError("Module config: Invalid or missing configuration dist file : %s", cfg_def_file.c_str());
|
||||
sLog->outError("Module config: Verify that the file exists and has \'[worldserver]' written in the top of the file!");
|
||||
sLog->outError("Module config: Use default settings!");
|
||||
sLog->outString();
|
||||
}
|
||||
|
||||
// Load .conf config
|
||||
if (!sConfigMgr->LoadMore(cfg_file.c_str()))
|
||||
{
|
||||
sLog->outString();
|
||||
sLog->outError("Module config: Invalid or missing configuration file : %s", cfg_file.c_str());
|
||||
sLog->outError("Module config: Verify that the file exists and has \'[worldserver]' written in the top of the file!");
|
||||
sLog->outError("Module config: Use default settings!");
|
||||
sLog->outString();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -345,4 +368,4 @@ void AddSC_premium_account()
|
||||
{
|
||||
new premium_account();
|
||||
new premium_world();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user