mirror of
https://github.com/xtjoeytx/GServer-v2.git
synced 2026-05-09 00:59:55 -04:00
ef93203bac
Added IEnums.h to store all the enums. Added NCI_NPCWARP. Added missing break statements. :x
55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
#ifndef CFILESYSTEM_H
|
|
#define CFILESYSTEM_H
|
|
|
|
#include <map>
|
|
#include "ICommon.h"
|
|
#include "CString.h"
|
|
//#include "TServer.h"
|
|
|
|
namespace boost
|
|
{
|
|
class recursive_mutex;
|
|
}
|
|
|
|
class TServer;
|
|
class CFileSystem
|
|
{
|
|
public:
|
|
CFileSystem() : server(0) { }
|
|
CFileSystem(TServer* pServer);
|
|
~CFileSystem();
|
|
void clear();
|
|
|
|
void setServer(TServer* pServer) { server = pServer; }
|
|
|
|
void addDir(const CString& dir, const CString& wildcard = "*", bool forceRecursive = false);
|
|
void removeDir(const CString& dir);
|
|
void addFile(CString file);
|
|
void removeFile(const CString& file);
|
|
void resync();
|
|
|
|
CString find(const CString& file) const;
|
|
CString findi(const CString& file) const;
|
|
CString load(const CString& file) const;
|
|
time_t getModTime(const CString& file) const;
|
|
bool setModTime(const CString& file, time_t modTime) const;
|
|
int getFileSize(const CString& file) const;
|
|
std::map<CString, CString>* getFileList() { return &fileList; }
|
|
std::vector<CString>* getDirList() { return &dirList; }
|
|
|
|
mutable boost::recursive_mutex* m_preventChange;
|
|
|
|
static void fixPathSeparators(CString* pPath);
|
|
static char getPathSeparator();
|
|
|
|
private:
|
|
void loadAllDirectories(const CString& directory, bool recursive = false);
|
|
|
|
TServer* server;
|
|
CString basedir;
|
|
std::map<CString, CString> fileList;
|
|
std::vector<CString> dirList;
|
|
};
|
|
|
|
#endif
|