2020-01-01 21:29:24 +01:00
|
|
|
#ifndef FILESYSTEMUTILS_H
|
|
|
|
#define FILESYSTEMUTILS_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2020-06-04 04:37:01 +02:00
|
|
|
// Forward declaration, including the entirety of tinyxml2.h across all files this file is included in is unnecessary
|
|
|
|
namespace tinyxml2 { class XMLDocument; }
|
Replace TiXmlDocument load and save functions by PHYSFS
The TinyXml functions to load and save files don't properly support
unicode file paths on Windows, so in order to support that properly, I
saw no other option than to do the actual loading and saving via PHYSFS
(or to use the Windows API on Windows and retain doc.LoadFile and
doc.SaveFile on other OSes, but that'd be more complicated and
unnecessary, we already have PHYSFS, right?).
There are two new functions in FileSystemUtils:
bool FILESYSTEM_saveTiXmlDocument(const char *name, TiXmlDocument *doc)
bool FILESYSTEM_loadTiXmlDocument(const char *name, TiXmlDocument *doc)
Any instances of doc.SaveFile(<FULL_PATH>) have been replaced by
FILESYSTEM_saveTiXmlDocument(<VVVVVV_FOLDER_PATH>, &doc), where
<FULL_PATH> included the full path to the saves or levels directory,
and <VVVVVV_FOLDER_PATH> only includes the path relative to the VVVVVV
directory.
When loading a document, a TiXmlDocument used to be created with a full
path in its constructor and doc.LoadFile() would then be called, now a
TiXmlDocument is constructed with no path name and
FILESYSTEM_loadTiXmlDocument(<VVVVVV_FOLDER_PATH>, &doc) is called.
2020-01-12 15:17:39 +01:00
|
|
|
|
2020-02-09 00:49:03 +01:00
|
|
|
int FILESYSTEM_init(char *argvZero, char* baseDir, char* assetsPath);
|
2020-01-01 21:29:24 +01:00
|
|
|
void FILESYSTEM_deinit();
|
|
|
|
|
|
|
|
char *FILESYSTEM_getUserSaveDirectory();
|
|
|
|
char *FILESYSTEM_getUserLevelDirectory();
|
|
|
|
|
2020-06-01 01:31:02 +02:00
|
|
|
bool FILESYSTEM_directoryExists(const char *fname);
|
|
|
|
void FILESYSTEM_mount(const char *fname);
|
|
|
|
void FILESYSTEM_unmountassets();
|
|
|
|
|
2020-01-24 21:35:46 +01:00
|
|
|
void FILESYSTEM_loadFileToMemory(const char *name, unsigned char **mem,
|
|
|
|
size_t *len, bool addnull = false);
|
2020-01-01 21:29:24 +01:00
|
|
|
void FILESYSTEM_freeMemory(unsigned char **mem);
|
2020-06-03 18:54:05 +02:00
|
|
|
bool FILESYSTEM_saveTiXml2Document(const char *name, tinyxml2::XMLDocument& doc);
|
2020-06-03 19:00:53 +02:00
|
|
|
bool FILESYSTEM_loadTiXml2Document(const char *name, tinyxml2::XMLDocument& doc);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
std::vector<std::string> FILESYSTEM_getLevelDirFileNames();
|
|
|
|
|
2020-04-18 03:48:55 +02:00
|
|
|
bool FILESYSTEM_openDirectoryEnabled();
|
|
|
|
bool FILESYSTEM_openDirectory(const char *dname);
|
|
|
|
|
2020-04-26 22:22:26 +02:00
|
|
|
bool FILESYSTEM_delete(const char *name);
|
|
|
|
|
2020-01-01 21:29:24 +01:00
|
|
|
#endif /* FILESYSTEMUTILS_H */
|