CreateDirectory replaced by cross-platform mkdir function

This commit is contained in:
Arkadiy Shapkin 2012-07-25 22:10:39 +04:00
parent ff72d1fb82
commit ef1c69cf15
2 changed files with 27 additions and 25 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
# intermediate files # intermediate files
Win32/ Win32/
x64/ x64/
ipch/
resources/out/ resources/out/
*.sdf *.sdf
*.suo *.suo

View File

@ -1,5 +1,6 @@
#include "tinyxml2.h" #include "tinyxml2.h"
#include <direct.h>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <ctime> #include <ctime>
@ -155,7 +156,7 @@ int main( int /*argc*/, const char ** /*argv*/ )
#pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated. #pragma warning ( disable : 4996 ) // Fail to see a compelling reason why this should be deprecated.
#endif #endif
CreateDirectory( L"resources/out/", NULL ); mkdir( "resources/out/" );
FILE* fp = fopen( "resources/dream.xml", "r" ); FILE* fp = fopen( "resources/dream.xml", "r" );
if ( !fp ) { if ( !fp ) {
@ -184,14 +185,14 @@ int main( int /*argc*/, const char ** /*argv*/ )
{ {
static const char* test[] = { "<element />", static const char* test[] = { "<element />",
"<element></element>", "<element></element>",
"<element><subelement/></element>", "<element><subelement/></element>",
"<element><subelement></subelement></element>", "<element><subelement></subelement></element>",
"<element><subelement><subsub/></subelement></element>", "<element><subelement><subsub/></subelement></element>",
"<!--comment beside elements--><element><subelement></subelement></element>", "<!--comment beside elements--><element><subelement></subelement></element>",
"<!--comment beside elements, this time with spaces--> \n <element> <subelement> \n </subelement> </element>", "<!--comment beside elements, this time with spaces--> \n <element> <subelement> \n </subelement> </element>",
"<element attrib1='foo' attrib2=\"bar\" ></element>", "<element attrib1='foo' attrib2=\"bar\" ></element>",
"<element attrib1='foo' attrib2=\"bar\" ><subelement attrib3='yeehaa' /></element>", "<element attrib1='foo' attrib2=\"bar\" ><subelement attrib3='yeehaa' /></element>",
"<element>Text inside element.</element>", "<element>Text inside element.</element>",
"<element><b></b></element>", "<element><b></b></element>",
"<element>Text inside and <b>bolded</b> in the element.</element>", "<element>Text inside and <b>bolded</b> in the element.</element>",
@ -210,10 +211,10 @@ int main( int /*argc*/, const char ** /*argv*/ )
#if 1 #if 1
{ {
static const char* test = "<!--hello world\n" static const char* test = "<!--hello world\n"
" line 2\r" " line 2\r"
" line 3\r\n" " line 3\r\n"
" line 4\n\r" " line 4\n\r"
" line 5\r-->"; " line 5\r-->";
XMLDocument doc; XMLDocument doc;
doc.Parse( test ); doc.Parse( test );
@ -303,24 +304,24 @@ int main( int /*argc*/, const char ** /*argv*/ )
doc.PrintError(); doc.PrintError();
XMLTest( "Dream", "xml version=\"1.0\"", XMLTest( "Dream", "xml version=\"1.0\"",
doc.FirstChild()->ToDeclaration()->Value() ); doc.FirstChild()->ToDeclaration()->Value() );
XMLTest( "Dream", true, doc.FirstChild()->NextSibling()->ToUnknown() ? true : false ); XMLTest( "Dream", true, doc.FirstChild()->NextSibling()->ToUnknown() ? true : false );
XMLTest( "Dream", "DOCTYPE PLAY SYSTEM \"play.dtd\"", XMLTest( "Dream", "DOCTYPE PLAY SYSTEM \"play.dtd\"",
doc.FirstChild()->NextSibling()->ToUnknown()->Value() ); doc.FirstChild()->NextSibling()->ToUnknown()->Value() );
XMLTest( "Dream", "And Robin shall restore amends.", XMLTest( "Dream", "And Robin shall restore amends.",
doc.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() ); doc.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() );
XMLTest( "Dream", "And Robin shall restore amends.", XMLTest( "Dream", "And Robin shall restore amends.",
doc.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() ); doc.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() );
XMLDocument doc2; XMLDocument doc2;
doc2.LoadFile( "resources/out/dreamout.xml" ); doc2.LoadFile( "resources/out/dreamout.xml" );
XMLTest( "Dream-out", "xml version=\"1.0\"", XMLTest( "Dream-out", "xml version=\"1.0\"",
doc2.FirstChild()->ToDeclaration()->Value() ); doc2.FirstChild()->ToDeclaration()->Value() );
XMLTest( "Dream-out", true, doc2.FirstChild()->NextSibling()->ToUnknown() ? true : false ); XMLTest( "Dream-out", true, doc2.FirstChild()->NextSibling()->ToUnknown() ? true : false );
XMLTest( "Dream-out", "DOCTYPE PLAY SYSTEM \"play.dtd\"", XMLTest( "Dream-out", "DOCTYPE PLAY SYSTEM \"play.dtd\"",
doc2.FirstChild()->NextSibling()->ToUnknown()->Value() ); doc2.FirstChild()->NextSibling()->ToUnknown()->Value() );
XMLTest( "Dream-out", "And Robin shall restore amends.", XMLTest( "Dream-out", "And Robin shall restore amends.",
doc2.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() ); doc2.LastChild()->LastChild()->LastChild()->LastChild()->LastChildElement()->GetText() );
//gNewTotal = gNew - newStart; //gNewTotal = gNew - newStart;
} }
@ -593,26 +594,26 @@ int main( int /*argc*/, const char ** /*argv*/ )
} }
{ {
const char* test = "<?xml version='1.0'?><a.elem xmi.version='2.0'/>"; const char* test = "<?xml version='1.0'?><a.elem xmi.version='2.0'/>";
XMLDocument doc; XMLDocument doc;
doc.Parse( test ); doc.Parse( test );
XMLTest( "dot in names", doc.Error(), false ); XMLTest( "dot in names", doc.Error(), false );
XMLTest( "dot in names", doc.FirstChildElement()->Name(), "a.elem" ); XMLTest( "dot in names", doc.FirstChildElement()->Name(), "a.elem" );
XMLTest( "dot in names", doc.FirstChildElement()->Attribute( "xmi.version" ), "2.0" ); XMLTest( "dot in names", doc.FirstChildElement()->Attribute( "xmi.version" ), "2.0" );
} }
{ {
const char* test = "<element><Name>1.1 Start easy ignore fin thickness&#xA;</Name></element>"; const char* test = "<element><Name>1.1 Start easy ignore fin thickness&#xA;</Name></element>";
XMLDocument doc; XMLDocument doc;
doc.Parse( test ); doc.Parse( test );
XMLText* text = doc.FirstChildElement()->FirstChildElement()->FirstChild()->ToText(); XMLText* text = doc.FirstChildElement()->FirstChildElement()->FirstChild()->ToText();
XMLTest( "Entity with one digit.", XMLTest( "Entity with one digit.",
text->Value(), "1.1 Start easy ignore fin thickness\n", text->Value(), "1.1 Start easy ignore fin thickness\n",
false ); false );
} }
{ {
// DOCTYPE not preserved (950171) // DOCTYPE not preserved (950171)