diff --git a/xmltest.cpp b/xmltest.cpp index 91a5626..336aeef 100644 --- a/xmltest.cpp +++ b/xmltest.cpp @@ -5,16 +5,20 @@ #endif #include "tinyxml2.h" +#include #include #include #include -#if defined( _MSC_VER ) +#if defined( _MSC_VER ) || defined (WIN32) #include #define WIN32_LEAN_AND_MEAN #include _CrtMemState startMemState; _CrtMemState endMemState; +#else + #include + #include #endif using namespace tinyxml2; @@ -334,6 +338,15 @@ int main( int argc, const char ** argv ) } fclose( fp ); +#if defined WIN32 + if ( !CreateDirectory( "resources/out", NULL ) && GetLastError() != ERROR_ALREADY_EXISTS ) { +#else + if ( mkdir( "resources/out", 0750 ) == -1 && errno != EEXIST ) { +#endif + printf( "Unable to create directory 'resources/out': %s\n", strerror( errno ) ); + exit( 1 ); + } + XMLTest( "Example-1", 0, example_1() ); XMLTest( "Example-2", 0, example_2() ); XMLTest( "Example-3", 0, example_3() );