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

56 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() {};
2015-12-23 21:26:46 -05:00
File(std::string file) : FilePath(file) { this->Read(); };
bool Exists() { return !this->Buffer.empty(); };
2015-12-23 21:26:46 -05:00
std::string GetName() { return this->FilePath; };
std::string& GetBuffer() { return this->Buffer; };
private:
std::string FilePath;
std::string Buffer;
void Read();
};
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();
};
2015-12-23 21:26:46 -05:00
FileSystem();
const char* GetName() { return "FileSystem"; };
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
};
}