split out OpenForReading

This commit is contained in:
Glenn Maynard
2005-03-17 23:43:13 +00:00
parent e76b50d499
commit c189f5fdd9
2 changed files with 22 additions and 16 deletions
+21 -16
View File
@@ -709,7 +709,28 @@ RageFileBasic *RageFileManager::Open( CString sPath, int mode, int &err )
* may be several that will work. */
if( mode & RageFile::WRITE )
return OpenForWriting( sPath, mode, err );
else
return OpenForReading( sPath, mode, err );
}
/* Copy a RageFileBasic for a new RageFile. */
RageFileBasic *RageFileManager::CopyFileObj( const RageFileBasic *cpy )
{
LockMut( *g_Mutex );
FileReferences::const_iterator it = g_Refs.find( cpy );
ASSERT_M( it != g_Refs.end(), ssprintf( "CopyFileObj: Missing reference (%s)", cpy->GetDisplayPath().c_str() ) );
RageFileBasic *ret = cpy->Copy();
/* It's from the same driver as the original. */
AddReference( ret, it->second );
return ret;
}
RageFileBasic *RageFileManager::OpenForReading( CString sPath, int mode, int &err )
{
NormalizePath( sPath );
vector<LoadedDriver> aDriverList;
@@ -740,22 +761,6 @@ RageFileBasic *RageFileManager::Open( CString sPath, int mode, int &err )
return NULL;
}
/* Copy a RageFileBasic for a new RageFile. */
RageFileBasic *RageFileManager::CopyFileObj( const RageFileBasic *cpy )
{
LockMut( *g_Mutex );
FileReferences::const_iterator it = g_Refs.find( cpy );
ASSERT_M( it != g_Refs.end(), ssprintf( "CopyFileObj: Missing reference (%s)", cpy->GetDisplayPath().c_str() ) );
RageFileBasic *ret = cpy->Copy();
/* It's from the same driver as the original. */
AddReference( ret, it->second );
return ret;
}
RageFileBasic *RageFileManager::OpenForWriting( CString sPath, int mode, int &err )
{
/*