X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/242fde5e8077f8193db4df5f262a9672085c8d8a..b2f752feb35d35e191205da26b5522038c04c2b6:/src/surf/surfxml_parse.c diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index e10788b48b..c82a3070ec 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2006-2014. The SimGrid Team. +/* Copyright (c) 2006-2015. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -7,7 +7,9 @@ #include #include #include /* va_arg */ +#ifndef _MSC_VER #include +#endif #include "xbt/misc.h" #include "xbt/log.h" @@ -324,7 +326,7 @@ void ETag_surfxml_include(void) { /** @brief When reaching EOF, check whether we are in an include tag, and behave accordingly if yes * - * This function is called automatically by sedding the parser in buildtools/Cmake/MaintainerMode.cmake + * This function is called automatically by sedding the parser in tools/cmake/MaintainerMode.cmake * Every FAIL on "Premature EOF" is preceded by a call to this function, which role is to restore the * previous buffer if we reached the EOF /of an include file/. Its return code is used to avoid the * error message in that case. @@ -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");