mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01: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:
parent
b67ac8a43b
commit
45ad048756
2 changed files with 17 additions and 0 deletions
|
@ -282,6 +282,21 @@ bool FILESYSTEM_loadTiXmlDocument(const char *name, TiXmlDocument *doc)
|
||||||
return true;
|
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> FILESYSTEM_getLevelDirFileNames()
|
||||||
{
|
{
|
||||||
std::vector<std::string> list;
|
std::vector<std::string> list;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "tinyxml.h"
|
#include "tinyxml.h"
|
||||||
|
#include "tinyxml2.h"
|
||||||
|
|
||||||
int FILESYSTEM_init(char *argvZero, char* baseDir, char* assetsPath);
|
int FILESYSTEM_init(char *argvZero, char* baseDir, char* assetsPath);
|
||||||
void FILESYSTEM_deinit();
|
void FILESYSTEM_deinit();
|
||||||
|
@ -21,6 +22,7 @@ void FILESYSTEM_loadFileToMemory(const char *name, unsigned char **mem,
|
||||||
void FILESYSTEM_freeMemory(unsigned char **mem);
|
void FILESYSTEM_freeMemory(unsigned char **mem);
|
||||||
bool FILESYSTEM_saveTiXmlDocument(const char *name, TiXmlDocument *doc);
|
bool FILESYSTEM_saveTiXmlDocument(const char *name, TiXmlDocument *doc);
|
||||||
bool FILESYSTEM_loadTiXmlDocument(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();
|
std::vector<std::string> FILESYSTEM_getLevelDirFileNames();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue