summaryrefslogtreecommitdiffstats
path: root/src/IniFile.cpp
diff options
context:
space:
mode:
authorJomar Milan <macaylamarvelous81@proton.me>2023-03-22 11:20:59 +0100
committerGitHub <noreply@github.com>2023-03-22 11:20:59 +0100
commitfddbf65e2819d487021946a51722d23565bdd561 (patch)
tree73410971d0cd85d8f49b4c2d9ac566f30f0777ae /src/IniFile.cpp
parentRemoved C style arrays from the BlockEntity folder (#5005) (diff)
downloadcuberite-fddbf65e2819d487021946a51722d23565bdd561.tar
cuberite-fddbf65e2819d487021946a51722d23565bdd561.tar.gz
cuberite-fddbf65e2819d487021946a51722d23565bdd561.tar.bz2
cuberite-fddbf65e2819d487021946a51722d23565bdd561.tar.lz
cuberite-fddbf65e2819d487021946a51722d23565bdd561.tar.xz
cuberite-fddbf65e2819d487021946a51722d23565bdd561.tar.zst
cuberite-fddbf65e2819d487021946a51722d23565bdd561.zip
Diffstat (limited to 'src/IniFile.cpp')
-rw-r--r--src/IniFile.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/IniFile.cpp b/src/IniFile.cpp
index 8b051dd9a..d65154072 100644
--- a/src/IniFile.cpp
+++ b/src/IniFile.cpp
@@ -147,6 +147,7 @@ bool cIniFile::ReadFile(const AString & a_FileName, bool a_AllowExampleRedirect)
{
valuename = line.substr(0, pLeft);
value = TrimString(line.substr(pLeft + 1));
+ ReplaceString(value, "\\n", "\n");
AddValue(keyname, valuename, value);
break;
}
@@ -191,6 +192,7 @@ bool cIniFile::WriteFile(const AString & a_FileName) const
// Normally you would use ofstream, but the SGI CC compiler has
// a few bugs with ofstream. So ... fstream used.
fstream f;
+ AString writevalue;
f.open((a_FileName).c_str(), ios::out);
if (f.fail())
@@ -223,7 +225,9 @@ bool cIniFile::WriteFile(const AString & a_FileName) const
// Values.
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;
}