mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[11216] Fixed crash at explictly empty string setting for dataDir in mangosd.conf.
This commit is contained in:
parent
06fe777f82
commit
5a3f557b19
2 changed files with 12 additions and 7 deletions
|
|
@ -839,19 +839,24 @@ void World::LoadConfigSettings(bool reload)
|
|||
setConfigPos(CONFIG_UINT32_CHARDELETE_KEEP_DAYS, "CharDelete.KeepDays", 30);
|
||||
|
||||
///- Read the "Data" directory from the config file
|
||||
std::string dataPath = sConfig.GetStringDefault("DataDir","./");
|
||||
if( dataPath.at(dataPath.length()-1)!='/' && dataPath.at(dataPath.length()-1)!='\\' )
|
||||
std::string dataPath = sConfig.GetStringDefault("DataDir", "./");
|
||||
|
||||
// for empty string use current dir as for absent case
|
||||
if (dataPath.empty())
|
||||
dataPath = "./";
|
||||
// normalize dir path to path/ or path\ form
|
||||
else if (dataPath.at(dataPath.length()-1) != '/' && dataPath.at(dataPath.length()-1) != '\\')
|
||||
dataPath.append("/");
|
||||
|
||||
if(reload)
|
||||
if (reload)
|
||||
{
|
||||
if(dataPath!=m_dataPath)
|
||||
sLog.outError("DataDir option can't be changed at mangosd.conf reload, using current value (%s).",m_dataPath.c_str());
|
||||
if (dataPath != m_dataPath)
|
||||
sLog.outError("DataDir option can't be changed at mangosd.conf reload, using current value (%s).", m_dataPath.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dataPath = dataPath;
|
||||
sLog.outString("Using DataDir %s",m_dataPath.c_str());
|
||||
sLog.outString("Using DataDir %s", m_dataPath.c_str());
|
||||
}
|
||||
|
||||
setConfig(CONFIG_BOOL_VMAP_INDOOR_CHECK, "vmap.enableIndoorCheck", true);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11215"
|
||||
#define REVISION_NR "11216"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue