summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorJohn Biddiscombe <jbiddiscombe@skippingmouse.co.uk>2001-09-01 20:13:56 (GMT)
committerJohn Biddiscombe <jbiddiscombe@skippingmouse.co.uk>2001-09-01 20:13:56 (GMT)
commit5ac8ecd9d2d94277c1758791cf863be699ce2ec8 (patch)
tree5db5e9bf388debc0f5681f00d8d5f01392565205 /Source/cmSystemTools.cxx
parent0645a5006166f557524eb31dd18788370f9f5d19 (diff)
downloadCMake-5ac8ecd9d2d94277c1758791cf863be699ce2ec8.zip
CMake-5ac8ecd9d2d94277c1758791cf863be699ce2ec8.tar.gz
CMake-5ac8ecd9d2d94277c1758791cf863be699ce2ec8.tar.bz2
ENH: Windows and Unix slash conversions return a char*, clean function
seperated from Convert function
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx18
1 files changed, 13 insertions, 5 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 4a2948b..4665a48 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -403,7 +403,7 @@ std::string cmSystemTools::Capitalized(const std::string& s)
// convert windows slashes to unix slashes \ with /
-void cmSystemTools::ConvertToUnixSlashes(std::string& path)
+const char *cmSystemTools::ConvertToUnixSlashes(std::string& path)
{
std::string::size_type pos = 0;
while((pos = path.find('\\', pos)) != std::string::npos)
@@ -416,10 +416,11 @@ void cmSystemTools::ConvertToUnixSlashes(std::string& path)
{
path = path.substr(0, path.size()-1);
}
+ return path.c_str();
}
-// convert windows slashes to unix slashes \ with /
-void cmSystemTools::CleanUpWindowsSlashes(std::string& path)
+// convert windows slashes to unix slashes
+const char *cmSystemTools::ConvertToWindowsSlashes(std::string& path)
{
std::string::size_type pos = 0;
while((pos = path.find('/', pos)) != std::string::npos)
@@ -432,15 +433,22 @@ void cmSystemTools::CleanUpWindowsSlashes(std::string& path)
{
path = path.substr(0, path.size()-1);
}
- // remove any duplicate // slashes
+ return path.c_str();
+}
+
+// convert Unix slashes / to Windows slashes \ and cleanup double \\
+const char *cmSystemTools::ConvertToWindowsSlashesAndCleanUp(std::string& path)
+{
+ cmSystemTools::ConvertToWindowsSlashes(path);
+ std::string::size_type pos = 0;
pos = 0;
while((pos = path.find("\\\\", pos)) != std::string::npos)
{
path.erase(pos, 1);
}
+ return path.c_str();
}
-
bool cmSystemTools::ParseFunction(std::ifstream& fin,
std::string& name,
std::vector<std::string>& arguments)