2003-12-04 08:25:59 +00:00
|
|
|
#ifndef RAGE_FILE_MANAGER_H
|
|
|
|
|
#define RAGE_FILE_MANAGER_H
|
|
|
|
|
|
|
|
|
|
#include "RageFile.h"
|
|
|
|
|
|
2004-03-04 00:19:42 +00:00
|
|
|
extern CString InitialWorkingDirectory;
|
|
|
|
|
extern CString DirOfExecutable;
|
|
|
|
|
|
2003-12-04 08:25:59 +00:00
|
|
|
class RageFileObj;
|
|
|
|
|
class RageFileManager
|
|
|
|
|
{
|
|
|
|
|
public:
|
2004-03-04 00:19:42 +00:00
|
|
|
RageFileManager( CString argv0 );
|
2003-12-04 08:25:59 +00:00
|
|
|
~RageFileManager();
|
2004-03-04 01:16:52 +00:00
|
|
|
void MountInitialFilesystems();
|
2003-12-04 08:25:59 +00:00
|
|
|
|
2003-12-16 07:23:54 +00:00
|
|
|
void GetDirListing( const CString &sPath, CStringArray &AddTo, bool bOnlyDirs, bool bReturnPathToo );
|
|
|
|
|
bool Remove( const CString &sPath );
|
2003-12-05 02:25:32 +00:00
|
|
|
|
2003-12-04 08:25:59 +00:00
|
|
|
enum FileType { TYPE_FILE, TYPE_DIR, TYPE_NONE };
|
|
|
|
|
FileType GetFileType( const CString &sPath );
|
|
|
|
|
|
|
|
|
|
bool IsAFile( const CString &sPath );
|
|
|
|
|
bool IsADirectory( const CString &sPath );
|
|
|
|
|
bool DoesFileExist( const CString &sPath );
|
|
|
|
|
|
|
|
|
|
int GetFileSizeInBytes( const CString &sPath );
|
2003-12-10 07:07:42 +00:00
|
|
|
int GetFileHash( const CString &sPath );
|
2003-12-04 08:25:59 +00:00
|
|
|
|
2003-12-05 00:07:18 +00:00
|
|
|
void Mount( CString Type, CString RealPath, CString MountPoint );
|
2004-03-15 02:52:55 +00:00
|
|
|
void Unmount( CString Type, CString Root, CString MountPoint );
|
2003-12-05 00:07:18 +00:00
|
|
|
bool IsMounted( CString MountPoint );
|
|
|
|
|
bool MountpointIsReady( CString MountPoint );
|
2004-03-15 03:05:55 +00:00
|
|
|
struct DriverLocation
|
|
|
|
|
{
|
|
|
|
|
CString Type, Root, MountPoint;
|
|
|
|
|
};
|
|
|
|
|
void GetLoadedDrivers( vector<DriverLocation> &Mounts );
|
2003-12-04 08:25:59 +00:00
|
|
|
|
2003-12-07 04:21:04 +00:00
|
|
|
void FlushDirCache( const CString &sPath );
|
|
|
|
|
|
2003-12-04 08:25:59 +00:00
|
|
|
/* Used only by RageFile: */
|
2003-12-21 07:23:29 +00:00
|
|
|
RageFileObj *Open( const CString &sPath, int mode, RageFile &p, int &err );
|
2003-12-11 05:32:35 +00:00
|
|
|
void Close( RageFileObj *obj );
|
2003-12-11 07:13:20 +00:00
|
|
|
RageFileObj *CopyFileObj( const RageFileObj *cpy, RageFile &p );
|
2003-12-05 02:25:32 +00:00
|
|
|
|
|
|
|
|
private:
|
2003-12-21 07:23:29 +00:00
|
|
|
RageFileObj *OpenForWriting( const CString &sPath, int mode, RageFile &p, int &err );
|
2003-12-04 08:25:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern RageFileManager *FILEMAN;
|
|
|
|
|
|
|
|
|
|
#endif
|