mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 09:54:10 +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;
|
||||
|
||||
Reference in New Issue
Block a user