Merge commit 'fddbf65e2819d487021946a51722d23565bdd561' into pullstream
This commit is contained in:
commit
9bba8698f8
@ -5375,6 +5375,10 @@ ValueName0=SomeOtherValue
|
|||||||
insert values by hand. Then you can store the object's contents to a disk file using WriteFile(), or
|
insert values by hand. Then you can store the object's contents to a disk file using WriteFile(), or
|
||||||
just forget everything by destroying the object. Note that the file operations are quite slow.</p>
|
just forget everything by destroying the object. Note that the file operations are quite slow.</p>
|
||||||
<p>
|
<p>
|
||||||
|
Cuberite will write the characters '\n' in place of line breaks in the values of the cIniFile when
|
||||||
|
it is being stored into a file. It will also replace '\n' with line breaks when it reads an INI
|
||||||
|
file.
|
||||||
|
<p>
|
||||||
For storing high-volume low-latency data, use the {{sqlite3}} class. For storing
|
For storing high-volume low-latency data, use the {{sqlite3}} class. For storing
|
||||||
hierarchically-structured data, use the XML format, using the LuaExpat parser in the {{lxp}} class.
|
hierarchically-structured data, use the XML format, using the LuaExpat parser in the {{lxp}} class.
|
||||||
]],
|
]],
|
||||||
|
@ -163,6 +163,7 @@ bool cIniFile::ReadFile(const AString & a_FileName, bool a_AllowExampleRedirect)
|
|||||||
{
|
{
|
||||||
valuename = line.substr(0, pLeft);
|
valuename = line.substr(0, pLeft);
|
||||||
value = TrimString(line.substr(pLeft + 1));
|
value = TrimString(line.substr(pLeft + 1));
|
||||||
|
ReplaceString(value, "\\n", "\n");
|
||||||
AddValue(keyname, valuename, value);
|
AddValue(keyname, valuename, value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -207,6 +208,7 @@ bool cIniFile::WriteFile(const AString & a_FileName) const
|
|||||||
// Normally you would use ofstream, but the SGI CC compiler has
|
// Normally you would use ofstream, but the SGI CC compiler has
|
||||||
// a few bugs with ofstream. So ... fstream used.
|
// a few bugs with ofstream. So ... fstream used.
|
||||||
fstream f;
|
fstream f;
|
||||||
|
AString writevalue;
|
||||||
|
|
||||||
f.open((a_FileName).c_str(), ios::out);
|
f.open((a_FileName).c_str(), ios::out);
|
||||||
if (f.fail())
|
if (f.fail())
|
||||||
@ -239,7 +241,9 @@ bool cIniFile::WriteFile(const AString & a_FileName) const
|
|||||||
// Values.
|
// Values.
|
||||||
for (size_t valueID = 0; valueID < m_Keys[keyID].m_Names.size(); ++valueID)
|
for (size_t valueID = 0; valueID < m_Keys[keyID].m_Names.size(); ++valueID)
|
||||||
{
|
{
|
||||||
f << m_Keys[keyID].m_Names[valueID] << '=' << m_Keys[keyID].m_Values[valueID] << iniEOL;
|
writevalue = m_Keys[keyID].m_Values[valueID];
|
||||||
|
ReplaceString(writevalue, "\n", "\\n");
|
||||||
|
f << m_Keys[keyID].m_Names[valueID] << '=' << writevalue << iniEOL;
|
||||||
}
|
}
|
||||||
f << iniEOL;
|
f << iniEOL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user