00001
00002
00003
00004
00005
#ifndef RAGE_FILE_MANAGER_H
00006
#define RAGE_FILE_MANAGER_H
00007
00008
#include "RageFile.h"
00009
00010 extern CString InitialWorkingDirectory;
00011 extern CString DirOfExecutable;
00012
class RageFileDriver;
00013
00014 class RageFileManager
00015 {
00016
public:
00017
RageFileManager(
CString argv0 );
00018
~RageFileManager();
00019
void MountInitialFilesystems();
00020
00021
void GetDirListing(
CString sPath,
CStringArray &AddTo,
bool bOnlyDirs,
bool bReturnPathToo );
00022
bool Remove(
CString sPath );
00023
void CreateDir(
CString sDir );
00024
00025 enum FileType {
TYPE_FILE,
TYPE_DIR,
TYPE_NONE };
00026 FileType GetFileType( CString sPath );
00027
00028
bool IsAFile(
const CString &sPath );
00029
bool IsADirectory(
const CString &sPath );
00030
bool DoesFileExist(
const CString &sPath );
00031
00032
int GetFileSizeInBytes( CString sPath );
00033
int GetFileHash( CString sPath );
00034
00035
void Mount( CString Type, CString RealPath, CString MountPoint );
00036
void Unmount( CString Type, CString Root, CString MountPoint );
00037
00038
00039
00040
00041
static void Remount( CString sMountpoint, CString sPath );
00042
bool IsMounted( CString MountPoint );
00043
bool MountpointIsReady( CString MountPoint );
00044 struct DriverLocation
00045 {
00046 CString Type,
Root,
MountPoint;
00047 };
00048
void GetLoadedDrivers( vector<DriverLocation> &Mounts );
00049
00050
void FlushDirCache( CString sPath );
00051
00052
00053
RageFileBasic *
Open( CString sPath,
int mode,
int &err );
00054
void Close(
RageFileBasic *obj );
00055
RageFileBasic *
CopyFileObj(
const RageFileBasic *cpy );
00056
00057
00058
RageFileDriver *
GetFileDriver( CString sMountpoint );
00059
void ReleaseFileDriver(
RageFileDriver *pDriver );
00060
00061
private:
00062
RageFileBasic *
OpenForWriting( CString sPath,
int mode,
int &err );
00063 };
00064
00065 extern RageFileManager *
FILEMAN;
00066
00067
#endif
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092