diff options
Diffstat (limited to 'Source/cmExtraEclipseCDT4Generator.cxx')
-rw-r--r-- | Source/cmExtraEclipseCDT4Generator.cxx | 16 |
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, "&", "&"); + cmSystemTools::ReplaceString(str, "<", "<"); + cmSystemTools::ReplaceString(str, ">", ">"); + cmSystemTools::ReplaceString(str, "\"", """); + // NOTE: This one is not necessary, since as of Eclipse CDT4 it will + // automatically change this to the original value ('). + //cmSystemTools::ReplaceString(str, "'", "'"); + return str; +} + //---------------------------------------------------------------------------- // Helper functions //---------------------------------------------------------------------------- |