summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 200889a..3e4efc6 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -441,13 +441,16 @@ std::string cmSystemTools::ConvertToUnixOutputPath(const char* path)
if(ret.find(" ") != std::string::npos)
{
std::string result = "";
+ char lastch = 1;
for(const char* ch = ret.c_str(); *ch != '\0'; ++ch)
{
- if(*ch == ' ')
+ // if it is already escaped then don't try to escape it again
+ if(*ch == ' ' && lastch != '\\')
{
result += '\\';
}
result += *ch;
+ lastch = *ch;
}
ret = result;
}