diff options
author | José Fonseca <jfonseca@vmware.com> | 2011-03-13 22:18:36 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2011-03-13 22:18:36 +0000 |
commit | a46710f39f55cc81905caf1b48803f66a2d8eb97 (patch) | |
tree | 868cf62604139314b52f0d4c1d3c8d5f92aa3dba | |
parent | 4c29ec8d7e028743b75ce492e1d5b8187445419a (diff) |
shader_runner: libgen.h not available on MSVC; use _splitpath instead.
-rw-r--r-- | tests/shaders/shader_runner.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c index 30e8a2960..9e4a5ccc7 100644 --- a/tests/shaders/shader_runner.c +++ b/tests/shaders/shader_runner.c @@ -31,7 +31,11 @@ #endif #include <string.h> #include <ctype.h> +#if defined(WIN32) +#include <stdlib.h> +#else #include <libgen.h> +#endif #include "piglit-util.h" int piglit_width = 250, piglit_height = 250; @@ -900,11 +904,24 @@ piglit_init(int argc, char **argv) if (argc > 2) { path = argv[2]; } else { +#if defined(WIN32) + char drive[_MAX_DRIVE]; + char dir[_MAX_DIR]; + char fname[_MAX_FNAME]; + char ext[_MAX_EXT]; + char* scriptpath; + _splitpath(argv[1], drive, dir, fname, ext); + scriptpath = malloc(strlen(drive) + strlen(dir) + 1); + strcpy(scriptpath, drive); + strcat(scriptpath, dir); + path = scriptpath; +#else /* Because dirname()'s memory handling is unpredictable, we * must copy both its input and ouput. */ char* scriptpath = strdup(argv[1]); path = strdup(dirname(scriptpath)); free(scriptpath); +#endif } process_test_script(argv[1]); |