| 24 | #include "console/console.h" |
| 25 | |
| 26 | bool fsTiXmlDocument::LoadFile( const char * pFilename, TiXmlEncoding encoding ) |
| 27 | { |
| 28 | // Expand the file-path. |
| 29 | char filenameBuffer[1024]; |
| 30 | Con::expandToolScriptFilename( filenameBuffer, sizeof(filenameBuffer), pFilename ); |
| 31 | |
| 32 | FileStream stream; |
| 33 | |
| 34 | #ifdef TORQUE_OS_ANDROID |
| 35 | if (strlen(pFilename) > strlen(filenameBuffer)) { |
| 36 | strcpy(filenameBuffer, pFilename); |
| 37 | } |
| 38 | #endif |
| 39 | |
| 40 | // File open for read? |
| 41 | if ( !stream.open( filenameBuffer, Torque::FS::File::Read ) ) |
| 42 | { |
| 43 | // No, so warn. |
| 44 | Con::warnf("TamlXmlParser::parse() - Could not open filename '%s' for parse.", filenameBuffer ); |
| 45 | return false; |
| 46 | } |
| 47 | |
| 48 | // Load document from stream. |
| 49 | if ( !LoadFile( stream ) ) |
| 50 | { |
| 51 | // Warn! |
| 52 | Con::warnf("TamlXmlParser: Could not load Taml XML file from stream."); |
| 53 | return false; |
| 54 | } |
| 55 | |
| 56 | // Close the stream. |
| 57 | stream.close(); |
| 58 | return true; |
| 59 | } |
| 60 | |
| 61 | bool fsTiXmlDocument::SaveFile( const char * pFilename ) const |
| 62 | { |
no test coverage detected