Add love.filesystem.mountFullPath.

This commit is contained in:
Alex Szpakowski
2020-10-03 19:28:57 -03:00
parent dcf0968f05
commit 0706b6243c
13 changed files with 494 additions and 208 deletions
+29 -6
View File
@@ -71,6 +71,25 @@ public:
FILETYPE_MAX_ENUM
};
enum CommonPath
{
COMMONPATH_APP_IDENTITY,
COMMONPATH_APP_DOCUMENTS,
COMMONPATH_APP_TEMP,
COMMONPATH_USER_HOME,
COMMONPATH_USER_APPDATA,
COMMONPATH_USER_DESKTOP,
COMMONPATH_USER_DOCUMENTS,
COMMONPATH_MAX_ENUM
};
enum MountPermissions
{
MOUNT_PERMISSIONS_READ,
MOUNT_PERMISSIONS_READWRITE,
MOUNT_PERMISSIONS_MAX_ENUM
};
struct Info
{
// Numbers will be -1 if they cannot be determined.
@@ -136,8 +155,13 @@ public:
virtual bool mount(const char *archive, const char *mountpoint, bool appendToPath = false) = 0;
virtual bool mount(Data *data, const char *archivename, const char *mountpoint, bool appendToPath = false) = 0;
virtual bool mountFullPath(const char *archive, const char *mountpoint, MountPermissions permissions, bool appendToPath = false) = 0;
virtual bool mountCommonPath(CommonPath path, const char *mountpoint, MountPermissions permissions, bool appendToPath = false) = 0;
virtual bool unmount(const char *archive) = 0;
virtual bool unmount(Data *data) = 0;
virtual bool unmount(CommonPath path) = 0;
/**
* Creates a new file.
@@ -152,6 +176,8 @@ public:
**/
virtual FileData *newFileData(const void *data, size_t size, const char *filename) const;
virtual std::string getFullCommonPath(CommonPath path) = 0;
/**
* Gets the current working directory.
**/
@@ -263,18 +289,15 @@ public:
**/
virtual std::string getExecutablePath() const;
static bool getConstant(const char *in, FileType &out);
static bool getConstant(FileType in, const char *&out);
static std::vector<std::string> getConstants(FileType);
STRINGMAP_CLASS_DECLARE(FileType);
STRINGMAP_CLASS_DECLARE(CommonPath);
STRINGMAP_CLASS_DECLARE(MountPermissions);
private:
// Should we save external or internal for Android
bool useExternal;
static StringMap<FileType, FILETYPE_MAX_ENUM>::Entry fileTypeEntries[];
static StringMap<FileType, FILETYPE_MAX_ENUM> fileTypes;
}; // Filesystem
} // filesystem