summaryrefslogtreecommitdiffstats
path: root/Source/kwsys
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2005-05-03 14:02:28 (GMT)
committerBrad King <brad.king@kitware.com>2005-05-03 14:02:28 (GMT)
commit7dcb42de21a5667bdddb507400d0f63047c1dcf2 (patch)
treeb103dc251ee482ef6c745edbc8e06004a56ba9ae /Source/kwsys
parentde57a86298c761bd98f5f5e96a11fd1f51a99b70 (diff)
downloadCMake-7dcb42de21a5667bdddb507400d0f63047c1dcf2.zip
CMake-7dcb42de21a5667bdddb507400d0f63047c1dcf2.tar.gz
CMake-7dcb42de21a5667bdddb507400d0f63047c1dcf2.tar.bz2
ENH: Adding test of running executable with forward slashes on windows.
Diffstat (limited to 'Source/kwsys')
-rw-r--r--Source/kwsys/testProcess.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c
index 905233f..d4e498a 100644
--- a/Source/kwsys/testProcess.c
+++ b/Source/kwsys/testProcess.c
@@ -296,7 +296,28 @@ int main(int argc, const char* argv[])
double timeouts[6] = {10, 10, 10, 10, 30, 10};
int r;
const char* cmd[4];
+#ifdef _WIN32
+ char* argv0 = 0;
+ if(n == 0 && (argv0 = strdup(argv[0])))
+ {
+ /* Try converting to forward slashes to see if it works. */
+ char* c;
+ for(c=argv0; *c; ++c)
+ {
+ if(*c == '\\')
+ {
+ *c = '/';
+ }
+ }
+ cmd[0] = argv0;
+ }
+ else
+ {
+ cmd[0] = argv[0];
+ }
+#else
cmd[0] = argv[0];
+#endif
cmd[1] = "run";
cmd[2] = argv[1];
cmd[3] = 0;
@@ -310,6 +331,9 @@ int main(int argc, const char* argv[])
fprintf(stderr, "Output on stderr after test %d.\n", n);
fflush(stdout);
fflush(stderr);
+#if _WIN32
+ if(argv0) { free(argv0); }
+#endif
return r;
}
else