summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-10-12 15:38:24 (GMT)
committerBrad King <brad.king@kitware.com>2021-10-12 15:38:24 (GMT)
commit8d14ca3142d869eed7be953e156718f51a855e02 (patch)
tree037d24b3eef74bca6b067e3f6416e3f4209ad50e /Source/kwsys/SystemTools.cxx
parent6f1fe83f865edb276aa78dd9f5dda1dbebcf21e3 (diff)
parent58f046ba26d67c6e1ceda2a20977e316f1a942ad (diff)
downloadCMake-8d14ca3142d869eed7be953e156718f51a855e02.zip
CMake-8d14ca3142d869eed7be953e156718f51a855e02.tar.gz
CMake-8d14ca3142d869eed7be953e156718f51a855e02.tar.bz2
Merge branch 'upstream-KWSys' into update-kwsys
# By KWSys Upstream * upstream-KWSys: KWSys 2021-10-08 (b8c734ba)
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r--Source/kwsys/SystemTools.cxx26
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 930d84c..bd900fe 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -3767,6 +3767,32 @@ bool SystemTools::Split(const std::string& str,
return true;
}
+std::string SystemTools::Join(const std::vector<std::string>& list,
+ const std::string& separator)
+{
+ std::string result;
+ if (list.empty()) {
+ return result;
+ }
+
+ size_t total_size = separator.size() * (list.size() - 1);
+ for (const std::string& string : list) {
+ total_size += string.size();
+ }
+
+ result.reserve(total_size);
+ bool needs_separator = false;
+ for (const std::string& string : list) {
+ if (needs_separator) {
+ result += separator;
+ }
+ result += string;
+ needs_separator = true;
+ }
+
+ return result;
+}
+
/**
* Return path of a full filename (no trailing slashes).
* Warning: returned path is converted to Unix slashes format.