-
Notifications
You must be signed in to change notification settings - Fork 1
/
ModuleFileSystem.h
83 lines (60 loc) · 2.67 KB
/
ModuleFileSystem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef __MODULEFILESYSTEM_H__
#define __MODULEFILESYSTEM_H__
#include "Module.h"
#include <vector>
#include "FolderContainer.h"
struct SDL_RWops;
int close_sdl_rwops(SDL_RWops *rw);
struct aiFileIO;
#include "Bass/include/bass.h"
//struct BASS_FILEPROCS;
class ModuleFileSystem : public Module
{
public:
ModuleFileSystem(Application* app, bool start_enabled = true);
// Destructor
~ModuleFileSystem();
// Called before render is available
bool Init() override;
// Called before quitting
bool CleanUp() override;
// Utility functions
bool AddPath(const char* path_or_zip);
bool Exists(const char* file) const;
bool IsDirectory(const char* file) const;
void CreateDirectory(const char* directory);
void DiscoverFiles(const char* directory, std::vector<std::string>& file_list, std::vector<std::string>& dir_list) const;
bool CopyFromOutsideFS(const char* full_path, const char* destination);
bool Copy(const char* source, const char* destination);
void SplitFilePath(const char* full_path, std::string* path, std::string* file = nullptr, std::string* extension = nullptr, bool onlyName = false) const;
void NormalizePath(char* full_path) const;
void NormalizePath(std::string& full_path) const;
void GetAllFilesWithExtension(const char * directory, const char * extension, std::vector<std::string>& file_list) const;
bool CreateDir(const char * dir);
// Open for Read/Write
unsigned int Load(const char* path, const char* file, char** buffer) const;
unsigned int Load(const char* file, char** buffer) const;
SDL_RWops* Load(const char* file) const;
void* BassLoad(const char* file) const;
// IO interfaces for other libs to handle files via PHYSfs
aiFileIO* GetAssimpIO();
uint64 GetLastModTime(const char * filename);
FolderContainer RecursiveGetFoldersFiles(const char * directory, std::vector<std::string>* filter_ext = nullptr, std::vector<std::string>* ignore_ext = nullptr, std::vector<std::string>* list = nullptr);
bool HasExtension(const char * path) const;
bool HasExtension(const char * path, std::string extension) const;
bool HasExtension(const char * path, std::vector<std::string> extensions) const;
unsigned int Save(const char* file, const void* buffer, unsigned int size, bool append = false) const;
bool SaveUnique(std::string& output, const void* buffer, uint size, const char* path, const char* prefix, const char* extension);
bool Remove(const char* file);
const char* GetBasePath() const;
const char* GetWritePath() const;
const char* GetReadPaths() const;
private:
void CreateAssimpIO();
void CreateBassIO();
BASS_FILEPROCS * GetBassIO();
private:
aiFileIO* AssimpIO = nullptr;
BASS_FILEPROCS* BassIO = nullptr;
};
#endif // __MODULEFILESYSTEM_H__