Browse Source

Remove cmSystemTools::EscapeSpaces method

The last remaining call to this method exists only for compatibility.
Remove the method and put its implementation inline in place of the last
call.
Brad King 15 years ago
parent
commit
cb9ea2647f
3 changed files with 18 additions and 55 deletions
  1. 18 6
      Source/cmLocalGenerator.cxx
  2. 0 43
      Source/cmSystemTools.cxx
  3. 0 6
      Source/cmSystemTools.h

+ 18 - 6
Source/cmLocalGenerator.cxx

@@ -2810,17 +2810,29 @@ cmLocalGenerator
 std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str)
 std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str)
 {
 {
   std::string result;
   std::string result;
-  bool forceOn =  cmSystemTools::GetForceUnixPaths();
-  if(forceOn && this->WindowsShell)
+#if defined(_WIN32) && !defined(__CYGWIN__)
+  // if there are spaces
+  std::string temp = str;
+  if (temp.find(" ") != std::string::npos &&
+      temp.find("\"")==std::string::npos)
     {
     {
-    cmSystemTools::SetForceUnixPaths(false);
+    result = "\"";
+    result += str;
+    result += "\"";
+    return result;
     }
     }
-  result = cmSystemTools::EscapeSpaces(str);
-  if(forceOn && this->WindowsShell)
+  return str;
+#else
+  for(const char* ch = str; *ch != '\0'; ++ch)
     {
     {
-    cmSystemTools::SetForceUnixPaths(true);
+    if(*ch == ' ')
+      {
+      result += '\\';
+      }
+    result += *ch;
     }
     }
   return result;
   return result;
+#endif
 }
 }
 
 
 //----------------------------------------------------------------------------
 //----------------------------------------------------------------------------

+ 0 - 43
Source/cmSystemTools.cxx

@@ -191,49 +191,6 @@ std::string cmSystemTools::EscapeQuotes(const char* str)
   return result;
   return result;
 }
 }
 
 
-std::string cmSystemTools::EscapeSpaces(const char* str)
-{
-#if defined(_WIN32) && !defined(__CYGWIN__)
-  bool useDoubleQ = true;
-#else
-  bool useDoubleQ = false;
-#endif
-  if(cmSystemTools::s_ForceUnixPaths)
-    {
-    useDoubleQ = false;
-    }
-  
-  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;
-    }
-  else
-    {
-    std::string result = "";
-    for(const char* ch = str; *ch != '\0'; ++ch)
-      {
-      if(*ch == ' ')
-        {
-        result += '\\';
-        }
-      result += *ch;
-      }
-    return result;
-    }
-}
-
 void cmSystemTools::Error(const char* m1, const char* m2,
 void cmSystemTools::Error(const char* m1, const char* m2,
                           const char* m3, const char* m4)
                           const char* m3, const char* m4)
 {
 {

+ 0 - 6
Source/cmSystemTools.h

@@ -46,12 +46,6 @@ public:
   static void ExpandRegistryValues(std::string& source,
   static void ExpandRegistryValues(std::string& source,
                                    KeyWOW64 view = KeyWOW64_Default);
                                    KeyWOW64 view = KeyWOW64_Default);
 
 
-  /**
-   * Platform independent escape spaces, unix uses backslash,
-   * windows double quotes the string.
-   */
-  static std::string EscapeSpaces(const char* str);
-
   ///! Escape quotes in a string.
   ///! Escape quotes in a string.
   static std::string EscapeQuotes(const char* str);
   static std::string EscapeQuotes(const char* str);