{ \
FileDriverEntry_##name(): FileDriverEntry( type ) { } \
RageFileDriver *Create( const CString &sRoot ) const { return new RageFileDriver##name( sRoot ); } \
- } const g_RegisterDriver;
+ } const g_Register##name##Driver;
class RageFileBasic;
class FilenameDB;
#endif
REGISTER_FILE_DRIVER( Direct, "DIR" );
+REGISTER_FILE_DRIVER( DirectReadOnly, "DIRRO" );
// 64 KB buffer
static const unsigned int BUFFER_SIZE = 1024*64;
}
}
+/* The DIRRO driver is just like DIR, except writes are disallowed. */
+RageFileDriverDirectReadOnly::RageFileDriverDirectReadOnly( const CString &sRoot ) :
+ RageFileDriverDirect( sRoot ) { }
+
+RageFileBasic *RageFileDriverDirectReadOnly::Open( const CString &sPath, int iMode, int &iError )
+{
+ if( iMode & RageFile::WRITE )
+ {
+ iError = EROFS;
+ return NULL;
+ }
+
+ return RageFileDriverDirect::Open( sPath, iMode, iError );
+}
+bool RageFileDriverDirectReadOnly::Move( const CString &sOldPath, const CString &sNewPath ) { return false; }
+bool RageFileDriverDirectReadOnly::Remove( const CString &sPath ) { return false; }
+
+
bool RageFileObjDirect::OpenInternal( const CString &sPath, int iMode, int &iError )
{
m_sPath = sPath;
CString m_sRoot;
};
+class RageFileDriverDirectReadOnly: public RageFileDriverDirect
+{
+public:
+ RageFileDriverDirectReadOnly( const CString &sRoot );
+ RageFileBasic *Open( const CString &sPath, int iMode, int &iError );
+ bool Move( const CString &sOldPath, const CString &sNewPath );
+ bool Remove( const CString &sPath );
+};
+
#endif
/*
if( IsADirectory(PATCH_DATA_DIR) )
{
LOG->Info( "VFS: mounting Data/patch/patch/." );
- FILEMAN->Mount( "dir", PATCH_DATA_DIR, "/", false );
+ FILEMAN->Mount( "dirro", PATCH_DATA_DIR, "/", false );
}
else if( IsAFile(PATCH_FILE) )
{
{
/* Mount the root filesystem, so we can read files in /proc, /etc, and so on.
* This is /rootfs, not /root, to avoid confusion with root's home directory. */
- FILEMAN->Mount( "dir", "/", "/rootfs" );
+ FILEMAN->Mount( "dirro", "/", "/rootfs" );
/* Mount /proc, so Alsa9Buf::GetSoundCardDebugInfo() and others can access it.
* (Deprecated; use rootfs.) */
- FILEMAN->Mount( "dir", "/proc", "/proc" );
+ FILEMAN->Mount( "dirro", "/proc", "/proc" );
/* FileDB cannot accept relative paths, so Root must be absolute */
/* using DirOfExecutable for now --infamouspat */