summaryrefslogtreecommitdiffstats
path: root/Source/cmExtraEclipseCDT4Generator.cxx
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2009-01-08 23:09:50 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2009-01-08 23:09:50 (GMT)
commitcf0ab29fcb7edb67488da8498e3e1e68a48e5ca7 (patch)
tree7d4c4beb05a9f0245bab7e6127c23a7348ff0117 /Source/cmExtraEclipseCDT4Generator.cxx
parentef3e48c3d566a8d0d547a2a65bf18281a0aef664 (diff)
downloadCMake-cf0ab29fcb7edb67488da8498e3e1e68a48e5ca7.zip
CMake-cf0ab29fcb7edb67488da8498e3e1e68a48e5ca7.tar.gz
CMake-cf0ab29fcb7edb67488da8498e3e1e68a48e5ca7.tar.bz2
BUG: apply patch from #8205, also fixes #8212: escape characters for XML
when writing the eclipse project files Alex
Diffstat (limited to 'Source/cmExtraEclipseCDT4Generator.cxx')
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx16
1 files changed, 15 insertions, 1 deletions
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index d04ee73..713aeb9 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -573,7 +573,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
{
emmited.insert(def);
fout << "<pathentry kind=\"mac\" name=\"" << def
- << "\" path=\"\" value=\"" << val << "\"/>\n";
+ << "\" path=\"\" value=\"" << this->EscapeForXML(val)
+ << "\"/>\n";
}
}
}
@@ -792,6 +793,19 @@ cmExtraEclipseCDT4Generator::GenerateProjectName(const std::string& name,
return name + (type.empty() ? "" : "-") + type + "@" + path;
}
+std::string cmExtraEclipseCDT4Generator::EscapeForXML(const std::string& value)
+{
+ std::string str = value;
+ cmSystemTools::ReplaceString(str, "&", "&amp;");
+ cmSystemTools::ReplaceString(str, "<", "&lt;");
+ cmSystemTools::ReplaceString(str, ">", "&gt;");
+ cmSystemTools::ReplaceString(str, "\"", "&quot;");
+ // NOTE: This one is not necessary, since as of Eclipse CDT4 it will
+ // automatically change this to the original value (').
+ //cmSystemTools::ReplaceString(str, "'", "&apos;");
+ return str;
+}
+
//----------------------------------------------------------------------------
// Helper functions
//----------------------------------------------------------------------------