move RageFileManager mounting into the MemoryCardDriver, not MemoryCardManager
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#ifndef MEMORY_CARD_ENUMERATOR_H
|
||||
#define MEMORY_CARD_ENUMERATOR_H 1
|
||||
|
||||
|
||||
struct UsbStorageDevice
|
||||
{
|
||||
UsbStorageDevice() { MakeBlank(); }
|
||||
@@ -44,7 +43,7 @@ public:
|
||||
virtual ~MemoryCardDriver() {};
|
||||
virtual bool StorageDevicesChanged() = 0;
|
||||
virtual void GetStorageDevices( vector<UsbStorageDevice>& vStorageDevicesOut ) = 0;
|
||||
virtual bool MountAndTestWrite( UsbStorageDevice* pDevice ) = 0; // return false if mount or write fails
|
||||
virtual bool MountAndTestWrite( UsbStorageDevice* pDevice, CString sMountPoint ) = 0; // return false if mount or write fails
|
||||
virtual void Flush( UsbStorageDevice* pDevice ) {}
|
||||
virtual void ResetUsbStorage() {};
|
||||
};
|
||||
|
||||
@@ -231,7 +231,7 @@ void MemoryCardDriver_Linux::GetStorageDevices( vector<UsbStorageDevice>& vDevic
|
||||
}
|
||||
}
|
||||
|
||||
bool MemoryCardDriver_Linux::MountAndTestWrite( UsbStorageDevice* pDevice )
|
||||
bool MemoryCardDriver_Linux::MountAndTestWrite( UsbStorageDevice* pDevice, CString sMountPoint )
|
||||
{
|
||||
if( pDevice->sOsMountDir.empty() )
|
||||
return false;
|
||||
@@ -255,6 +255,12 @@ bool MemoryCardDriver_Linux::MountAndTestWrite( UsbStorageDevice* pDevice )
|
||||
fclose( fp );
|
||||
remove( sFile );
|
||||
|
||||
|
||||
// XXX: Remounting a different OS directory to the same mount point
|
||||
// seems to be broken. Investigate this later...
|
||||
FILEMAN->Mount( "dir", pDevice->sOsMountDir, sMountPoint.c_str() );
|
||||
LOG->Trace( "FILEMAN->Mount %s %s", pDevice->sOsMountDir.c_str(), sMountPoint.c_str() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ public:
|
||||
virtual ~MemoryCardDriver_Linux();
|
||||
virtual bool StorageDevicesChanged();
|
||||
virtual void GetStorageDevices( vector<UsbStorageDevice>& vStorageDevicesOut );
|
||||
virtual bool MountAndTestWrite( UsbStorageDevice* pDevice );
|
||||
virtual bool MountAndTestWrite( UsbStorageDevice* pDevice, CString sMountPoint );
|
||||
virtual void Flush( UsbStorageDevice* pDevice );
|
||||
virtual void ResetUsbStorage();
|
||||
protected:
|
||||
|
||||
@@ -9,7 +9,7 @@ public:
|
||||
MemoryCardDriver_Null() {};
|
||||
virtual bool StorageDevicesChanged() { return false; };
|
||||
virtual void GetStorageDevices( vector<UsbStorageDevice>& vStorageDevicesOut ) {};
|
||||
virtual bool MountAndTestWrite( UsbStorageDevice* pDevice ) { return false; };
|
||||
virtual bool MountAndTestWrite( UsbStorageDevice* pDevice, CString sMountPoint ) { return false; };
|
||||
virtual void Flush( UsbStorageDevice* pDevice ) {};
|
||||
};
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "RageUtil.h"
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include "RageFileManager.h"
|
||||
#include "RageLog.h"
|
||||
|
||||
MemoryCardDriver_Windows::MemoryCardDriver_Windows()
|
||||
{
|
||||
@@ -49,7 +51,7 @@ void MemoryCardDriver_Windows::GetStorageDevices( vector<UsbStorageDevice>& vDev
|
||||
}
|
||||
}
|
||||
|
||||
bool MemoryCardDriver_Windows::MountAndTestWrite( UsbStorageDevice* pDevice )
|
||||
bool MemoryCardDriver_Windows::MountAndTestWrite( UsbStorageDevice* pDevice, CString sMountPoint )
|
||||
{
|
||||
if( pDevice->sOsMountDir.empty() )
|
||||
return false;
|
||||
@@ -81,6 +83,11 @@ bool MemoryCardDriver_Windows::MountAndTestWrite( UsbStorageDevice* pDevice )
|
||||
fclose( fp );
|
||||
remove( sFile );
|
||||
|
||||
// XXX: Remounting a different OS directory to the same mount point
|
||||
// seems to be broken. Investigate this later...
|
||||
FILEMAN->Mount( "dir", pDevice->sOsMountDir, sMountPoint.c_str() );
|
||||
LOG->Trace( "FILEMAN->Mount %s %s", pDevice->sOsMountDir.c_str(), sMountPoint.c_str() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ public:
|
||||
virtual ~MemoryCardDriver_Windows();
|
||||
virtual bool StorageDevicesChanged();
|
||||
virtual void GetStorageDevices( vector<UsbStorageDevice>& vStorageDevicesOut );
|
||||
virtual bool MountAndTestWrite( UsbStorageDevice* pDevice );
|
||||
virtual bool MountAndTestWrite( UsbStorageDevice* pDevice, CString sMountPoint );
|
||||
virtual void Flush( UsbStorageDevice* pDevice );
|
||||
protected:
|
||||
DWORD m_dwLastLogicalDrives;
|
||||
|
||||
Reference in New Issue
Block a user