From 629863cd59afcc5ead778460b0ede8186d6ca2dd Mon Sep 17 00:00:00 2001
From: Brad King <brad.king@kitware.com>
Date: Wed, 16 May 2007 16:19:18 -0400
Subject: [PATCH] BUG: Shell escaping needs to write % as %% for VS IDE.

---
 System.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/System.c b/System.c
index fdf2b287..a2d575c1 100644
--- a/System.c
+++ b/System.c
@@ -287,6 +287,15 @@ static int kwsysSystem_Shell__GetArgumentSize(const char* in,
         ++size;
         }
       }
+    else if(*c == '%')
+      {
+      if(flags & kwsysSystem_Shell_Flag_VSIDE)
+        {
+        /* In a VS IDE a percent is written %% so we need one extra
+           characters.  */
+        size += 1;
+        }
+      }
     }
 
   /* Check whether the argument needs surrounding quotes.  */
@@ -432,6 +441,20 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out,
         *out++ = '#';
         }
       }
+    else if(*c == '%')
+      {
+      if(flags & kwsysSystem_Shell_Flag_VSIDE)
+        {
+        /* In a VS IDE a percent is written %%.  */
+        *out++ = '%';
+        *out++ = '%';
+        }
+      else
+        {
+        /* Otherwise a percent is written just %. */
+        *out++ = '%';
+        }
+      }
     else
       {
       /* Store this character.  */
-- 
GitLab