From 7dcb42de21a5667bdddb507400d0f63047c1dcf2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 3 May 2005 10:02:28 -0400 Subject: ENH: Adding test of running executable with forward slashes on windows. --- Source/kwsys/testProcess.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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 -- cgit v0.12