From 88e3bac79e8bdbf178ce7219200d3bbc040ec539 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 13 Sep 2015 15:33:43 +0200 Subject: [PATCH] there is no dirname() windows --- src/surf/surfxml_parse.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index ad461b9a56..c82a3070ec 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -7,7 +7,9 @@ #include #include #include /* va_arg */ +#ifndef _MSC_VER #include +#endif #include "xbt/misc.h" #include "xbt/log.h" @@ -1028,8 +1030,18 @@ void surf_parse_open(const char *file) if (!surf_parsed_filename_stack) surf_parsed_filename_stack = xbt_dynar_new(sizeof(char *), &xbt_free_ref); + +#ifdef _MSC_VER + /* There is no dirname on windows... */ + char drive[_MAX_DRIVE]; + char dir[_MAX_DIR]; + errno_t err; + err = _splitpath_s(file, drive, _MAX_DRIVE, dir, _MAX_DIR, NULL,0, NULL,0); + char *dir = bprintf("%s%s",drive,dir); +#else surf_parsed_filename = xbt_strdup(file); char *dir = dirname(surf_parsed_filename); +#endif xbt_dynar_push(surf_path, &dir); surf_file_to_parse = surf_fopen(file, "r"); -- 2.20.1