refactor common unmount code

This commit is contained in:
Chris Danford
2004-08-14 19:38:37 +00:00
parent ee9fbb99e1
commit ae319bd14e
4 changed files with 24 additions and 23 deletions
@@ -112,6 +112,7 @@ void MemoryCardDriverThreaded_Windows::MountThreadDoOneUpdate()
CString sProfileDir = TEMP_MOUNT_POINT + PREFSMAN->m_sMemoryCardProfileSubdir + '/';
profile.LoadEditableDataFromDir( sProfileDir );
usbd.sName = profile.GetDisplayName();
UnmountMountPoint( TEMP_MOUNT_POINT );
}
vNewStorageDevices.push_back( usbd );
@@ -136,17 +137,7 @@ void MemoryCardDriverThreaded_Windows::Mount( UsbStorageDevice* pDevice, CString
{
ASSERT( !pDevice->sOsMountDir.empty() );
/* Unmount any previous mounts for this mountpoint. */
vector<RageFileManager::DriverLocation> Mounts;
FILEMAN->GetLoadedDrivers( Mounts );
for( unsigned i = 0; i < Mounts.size(); ++i )
{
if( Mounts[i].Type.CompareNoCase( "dir" ) )
continue; // wrong type
if( Mounts[i].MountPoint.CompareNoCase( sMountPoint ) )
continue; // wrong mount point
FILEMAN->Unmount( Mounts[i].Type, Mounts[i].Root, Mounts[i].MountPoint );
}
UnmountMountPoint( sMountPoint );
FILEMAN->Mount( "dir", pDevice->sOsMountDir, sMountPoint.c_str() );
LOG->Trace( "FILEMAN->Mount %s %s", pDevice->sOsMountDir.c_str(), sMountPoint.c_str() );