mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 09:28:15 +03:00
Add FILESYSTEM_saveTiXml2Document()
This will eventually replace FILESYSTEM_saveTiXmlDocument(). Read it as "save TinyXML2 Document", not "save TinyXML to Document".
This commit is contained in:
@@ -282,6 +282,21 @@ bool FILESYSTEM_loadTiXmlDocument(const char *name, TiXmlDocument *doc)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FILESYSTEM_saveTiXml2Document(const char *name, tinyxml2::XMLDocument& doc)
|
||||
{
|
||||
/* XMLDocument.SaveFile doesn't account for Unicode paths, PHYSFS does */
|
||||
tinyxml2::XMLPrinter printer;
|
||||
doc.Print(&printer);
|
||||
PHYSFS_File* handle = PHYSFS_openWrite(name);
|
||||
if (handle == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
PHYSFS_writeBytes(handle, printer.CStr(), printer.CStrSize() - 1); // subtract one because CStrSize includes terminating null
|
||||
PHYSFS_close(handle);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::string> FILESYSTEM_getLevelDirFileNames()
|
||||
{
|
||||
std::vector<std::string> list;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "tinyxml.h"
|
||||
#include "tinyxml2.h"
|
||||
|
||||
int FILESYSTEM_init(char *argvZero, char* baseDir, char* assetsPath);
|
||||
void FILESYSTEM_deinit();
|
||||
@@ -21,6 +22,7 @@ void FILESYSTEM_loadFileToMemory(const char *name, unsigned char **mem,
|
||||
void FILESYSTEM_freeMemory(unsigned char **mem);
|
||||
bool FILESYSTEM_saveTiXmlDocument(const char *name, TiXmlDocument *doc);
|
||||
bool FILESYSTEM_loadTiXmlDocument(const char *name, TiXmlDocument *doc);
|
||||
bool FILESYSTEM_saveTiXml2Document(const char *name, tinyxml2::XMLDocument& doc);
|
||||
|
||||
std::vector<std::string> FILESYSTEM_getLevelDirFileNames();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user