mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-08 07:10:12 -05:00
Move the EscapeJSON method to a sharable location.
This commit is contained in:
@@ -2474,3 +2474,16 @@ void cmGlobalGenerator::WriteSummary(cmTarget* target)
|
||||
cmSystemTools::RemoveFile(file.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// static
|
||||
std::string cmGlobalGenerator::EscapeJSON(const std::string& s) {
|
||||
std::string result;
|
||||
for (std::string::size_type i = 0; i < s.size(); ++i) {
|
||||
if (s[i] == '"' || s[i] == '\\') {
|
||||
result += '\\';
|
||||
}
|
||||
result += s[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user