iw4x-client/src/Components/Modules/FileSystem.hpp

61 lines
1.2 KiB
C++
Raw Normal View History

2015-12-23 21:26:46 -05:00
namespace Components
{
class FileSystem : public Component
{
public:
class File
{
public:
File() : Size(-1), Name(), Handle(0) {};
File(std::string file);
~File();
2015-12-23 21:26:46 -05:00
bool Exists();
std::string GetName();
std::string GetBuffer();
bool Read(void* buffer, size_t size);
void Seek(int offset, int origin);
2015-12-23 21:26:46 -05:00
private:
int Handle;
int Size;
std::string Name;
2015-12-23 21:26:46 -05:00
};
2016-01-10 06:25:31 -05:00
class FileWriter
{
public:
FileWriter(std::string file) : FilePath(file), Handle(0) { this->Open(); };
~FileWriter() { this->Close(); };
void Write(std::string data);
private:
int Handle;
std::string FilePath;
void Open();
void Close();
};
2016-08-15 10:40:30 -04:00
FileSystem();
2016-09-16 05:04:28 -04:00
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
2015-12-23 21:26:46 -05:00
const char* GetName() { return "FileSystem"; };
2016-08-15 10:40:30 -04:00
#endif
2016-01-02 12:28:47 -05:00
2016-01-10 06:25:31 -05:00
static std::vector<std::string> GetFileList(std::string path, std::string extension);
2016-04-04 11:18:57 -04:00
static std::vector<std::string> GetSysFileList(std::string path, std::string extension, bool folders = false);
2016-01-10 06:25:31 -05:00
static void DeleteFile(std::string folder, std::string file);
2016-01-02 12:28:47 -05:00
private:
static void RegisterFolder(const char* folder);
static void RegisterFolders();
static void StartupStub();
2016-01-02 12:28:47 -05:00
static int ExecIsFSStub(const char* execFilename);
2015-12-23 21:26:46 -05:00
};
}