diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2006-08-14 13:50:52 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2006-08-14 13:50:52 (GMT) |
commit | 71af96aad1f9fc57cdf831207e9517514d238f16 (patch) | |
tree | 907014a48e6cce9ca998feb84816de1032b01b2e /Source/kwsys | |
parent | 5c1bd19eb8dbea03413dc1b9d5993fd3ade9ab24 (diff) | |
download | CMake-71af96aad1f9fc57cdf831207e9517514d238f16.zip CMake-71af96aad1f9fc57cdf831207e9517514d238f16.tar.gz CMake-71af96aad1f9fc57cdf831207e9517514d238f16.tar.bz2 |
ENH: still escape () but do not escape
Diffstat (limited to 'Source/kwsys')
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 19462af..7a7ae2c 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -1366,17 +1366,31 @@ kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const char* path) { ret.erase(pos, 1); } - // now escape spaces if there is a space in the path + // escape spaces and () in the path if(ret.find_first_of(" ()") != kwsys_stl::string::npos) { kwsys_stl::string result = ""; char lastch = 1; + bool inDollarVariable = false; for(const char* ch = ret.c_str(); *ch != '\0'; ++ch) { // if it is already escaped then don't try to escape it again if((*ch == ' ' || *ch == '(' || *ch == ')') && lastch != '\\') { - result += '\\'; + if(*ch == '(' && lastch == '$') + { + inDollarVariable = true; + } + // if we are in a $(..... and we get a ) then do not escape + // the ) and but set inDollarVariable to false + else if(*ch == ')' && inDollarVariable) + { + inDollarVariable = false; + } + else + { + result += '\\'; + } } result += *ch; lastch = *ch; |