64 lines
1.2 KiB
C++
64 lines
1.2 KiB
C++
#ifndef IFILESYSTEM_H__
|
|
#define IFILESYSTEM_H__
|
|
|
|
#include "../IDataStream.h"
|
|
#include "IContentProvider.h"
|
|
#include "../LString.h"
|
|
#include "IFolder.h"
|
|
#include "../Types.h"
|
|
#include <vector>
|
|
#include "../Error.h"
|
|
|
|
namespace LifeCore
|
|
{
|
|
class IFileSystem
|
|
{
|
|
public:
|
|
static const int IOBufferSize = 4096;
|
|
String StorageName;
|
|
int StorageID;
|
|
IFolder* GetRootFolder()
|
|
{
|
|
return g_rootFolder;
|
|
}
|
|
IFileSystem(IFolder* rootFolder)
|
|
{
|
|
g_rootFolder = rootFolder;
|
|
}
|
|
~IFileSystem()
|
|
{
|
|
if(g_rootFolder)
|
|
delete g_rootFolder;
|
|
}
|
|
int FileExists(String path)
|
|
{
|
|
return 1;
|
|
}
|
|
int GetFile(const String& path, IFile** file);
|
|
int GetFolder(const String& path, IFolder** output);
|
|
|
|
int NewFile(const String& path, int size);
|
|
int CreateFolder(const String& path);
|
|
|
|
/*IFile* GetFile(const String& path);
|
|
IFolder* GetFolder(const String& path);*/
|
|
|
|
void ReadFile(const String& src, void* buffer)
|
|
{
|
|
IFile* f1;
|
|
|
|
this->GetFile(src, &f1);
|
|
|
|
IDataStreamPtr srcStm = f1->OpenRead();
|
|
|
|
srcStm->Read(buffer, srcStm->Length());
|
|
srcStm->Close();
|
|
//f1->Close();
|
|
}
|
|
private:
|
|
LifeCore::IFolder* g_rootFolder;
|
|
std::vector<LifeCore::IFolder*> g_folders;
|
|
byte g_ioBuffer[IOBufferSize];
|
|
};
|
|
}
|
|
#endif |