summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-06-22 21:23:28 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-06-22 21:23:28 (GMT)
commitf1842f913718f97cb53ff5e313ea0c99b97dc132 (patch)
treef68e61c04dc30f335866fdd1f38c09a98467e104 /Source/cmSystemTools.cxx
parentb5f2442ba92fca35b65663059c025eb00f2219b4 (diff)
downloadCMake-f1842f913718f97cb53ff5e313ea0c99b97dc132.zip
CMake-f1842f913718f97cb53ff5e313ea0c99b97dc132.tar.gz
CMake-f1842f913718f97cb53ff5e313ea0c99b97dc132.tar.bz2
BUG: fix spaces in path with mingw and custom commands
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx52
1 files changed, 33 insertions, 19 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7ddb878..9fc0060 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -127,33 +127,47 @@ std::string cmSystemTools::EscapeQuotes(const char* str)
std::string cmSystemTools::EscapeSpaces(const char* str)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
- std::string result;
+ bool useDoubleQ = true;
+#else
+ bool useDoubleQ = false;
+#endif
+ if(cmSystemTools::s_ForceUnixPaths)
+ {
+ useDoubleQ = false;
+ }
- // if there are spaces
- std::string temp = str;
- if (temp.find(" ") != std::string::npos &&
- temp.find("\"")==std::string::npos)
- {
- result = "\"";
- result += str;
- result += "\"";
- return result;
+ if(useDoubleQ)
+ {
+ std::string result;
+
+ // if there are spaces
+ std::string temp = str;
+ if (temp.find(" ") != std::string::npos &&
+ temp.find("\"")==std::string::npos)
+ {
+ result = "\"";
+ result += str;
+ result += "\"";
+ return result;
+ }
+ return str;
}
- return str;
-#else
- std::string result = "";
- for(const char* ch = str; *ch != '\0'; ++ch)
+ else
{
- if(*ch == ' ')
+ std::string result = "";
+ for(const char* ch = str; *ch != '\0'; ++ch)
{
- result += '\\';
+ if(*ch == ' ')
+ {
+ result += '\\';
+ }
+ result += *ch;
}
- result += *ch;
+ return result;
}
- return result;
-#endif
}
+
std::string cmSystemTools::RemoveEscapes(const char* s)
{
std::string result = "";