diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-05-24 22:58:11 +0200 |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-05-24 23:22:20 +0200 |
commit | 5cec953e6aafd4c132a7b6c0a929d95c1dee79ea (patch) | |
tree | 09cf2f4a8f28c5ca8a7e648486fc10e1ae5e2d89 /Source/CPack/cmCPackNSISGenerator.cxx | |
parent | 2a1a2033afe73da08af46e12ed77a8f55a89417f (diff) | |
download | cmake-5cec953e6aafd4c132a7b6c0a929d95c1dee79ea.tar.gz |
Use std::replace for replacing chars in strings.
Find uses of `cmSystemTools::ReplaceString` where both `replace` and
`with` are string literals with a size of one.
Automate with:
git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\2', '\3');|g"
git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\(.\)\", \"\\\\\\\\\");|std::replace(\1.begin(), \1.end(), '\2', '\\\\\\\\');|g"
git grep -l ReplaceString | xargs sed -i "s|cmSystemTools::ReplaceString(\([^,]*\), \"\\\\\\\\\", \"\(.\)\");|std::replace(\1.begin(), \1.end(), '\\\\\\\\', '\2');|g"
Diffstat (limited to 'Source/CPack/cmCPackNSISGenerator.cxx')
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 4d48cb5c80..9fa588d076 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -74,7 +74,7 @@ int cmCPackNSISGenerator::PackageFiles() // Strip off the component part of the path. fileN = fileN.substr(fileN.find('/') + 1, std::string::npos); } - cmSystemTools::ReplaceString(fileN, "/", "\\"); + std::replace(fileN.begin(), fileN.end(), '/', '\\'); str << " Delete \"$INSTDIR\\" << fileN << "\"" << std::endl; } cmCPackLogger(cmCPackLog::LOG_DEBUG, "Uninstall Files: " << str.str() @@ -104,7 +104,7 @@ int cmCPackNSISGenerator::PackageFiles() fileN = fileN.substr(slash + 1, std::string::npos); } } - cmSystemTools::ReplaceString(fileN, "/", "\\"); + std::replace(fileN.begin(), fileN.end(), '/', '\\'); dstr << " RMDir \"$INSTDIR\\" << fileN << "\"" << std::endl; if (!componentName.empty()) { this->Components[componentName].Directories.push_back(fileN); @@ -548,7 +548,7 @@ void cmCPackNSISGenerator::CreateMenuLinks(std::ostringstream& str, // Convert / to \ in filenames, but not in urls: // if (!url) { - cmSystemTools::ReplaceString(sourceName, "/", "\\"); + std::replace(sourceName.begin(), sourceName.end(), '/', '\\'); } ++it; @@ -790,13 +790,13 @@ std::string cmCPackNSISGenerator::CreateComponentDescription( for (pathIt = component->Files.begin(); pathIt != component->Files.end(); ++pathIt) { path = *pathIt; - cmSystemTools::ReplaceString(path, "/", "\\"); + std::replace(path.begin(), path.end(), '/', '\\'); macrosOut << " Delete \"$INSTDIR\\" << path << "\"\n"; } for (pathIt = component->Directories.begin(); pathIt != component->Directories.end(); ++pathIt) { path = *pathIt; - cmSystemTools::ReplaceString(path, "/", "\\"); + std::replace(path.begin(), path.end(), '/', '\\'); macrosOut << " RMDir \"$INSTDIR\\" << path << "\"\n"; } macrosOut << " noremove_" << component->Name << ":\n"; |