Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

RageFileManager.h

Go to the documentation of this file.
00001 /* 00002 * RageFileManager: File utilities and high-level manager for RageFile objects. 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 /* Change the root of a filesystem. Only a couple drivers support this; it's 00039 * used to change memory card mountpoints without having to actually unmount 00040 * the driver. */ 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 /* Used only by RageFile: */ 00053 RageFileBasic *Open( CString sPath, int mode, int &err ); 00054 void Close( RageFileBasic *obj ); 00055 RageFileBasic *CopyFileObj( const RageFileBasic *cpy ); 00056 00057 /* Retrieve or release a reference to the low-level driver for a mountpoint. */ 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 * Copyright (c) 2001-2004 Glenn Maynard, Chris Danford 00071 * All rights reserved. 00072 * 00073 * Permission is hereby granted, free of charge, to any person obtaining a 00074 * copy of this software and associated documentation files (the 00075 * "Software"), to deal in the Software without restriction, including 00076 * without limitation the rights to use, copy, modify, merge, publish, 00077 * distribute, and/or sell copies of the Software, and to permit persons to 00078 * whom the Software is furnished to do so, provided that the above 00079 * copyright notice(s) and this permission notice appear in all copies of 00080 * the Software and that both the above copyright notice(s) and this 00081 * permission notice appear in supporting documentation. 00082 * 00083 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00084 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00085 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00086 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00087 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00088 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00089 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00090 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00091 * PERFORMANCE OF THIS SOFTWARE. 00092 */

Generated on Thu Jan 27 20:57:28 2005 for StepMania by doxygen 1.3.7