Preserves backwards compatibility with 10.6
sync_volume_np was introduced in the 10.8 SDK. This commit ensures that some related constants are defined before calling the function. If they are not, we fallback to the older logic.
This commit is contained in:
@@ -60,8 +60,25 @@ MemoryCardDriverThreaded_MacOSX::~MemoryCardDriverThreaded_MacOSX()
|
||||
|
||||
void MemoryCardDriverThreaded_MacOSX::Unmount( UsbStorageDevice *pDevice )
|
||||
{
|
||||
#if defined(SYNC_VOLUME_FULLSYNC) && defined(SYNC_VOLUME_WAIT)
|
||||
|
||||
if( sync_volume_np( pDevice->sOsMountDir.c_str(), SYNC_VOLUME_FULLSYNC | SYNC_VOLUME_WAIT ) != 0 )
|
||||
LOG->Warn( "Failed to flush the memory card." );
|
||||
#else
|
||||
ParamBlockRec pb;
|
||||
Str255 name; // A pascal string.
|
||||
const RString& base = Basename( pDevice->sOsMountDir );
|
||||
|
||||
memset( &pb, 0, sizeof(pb) );
|
||||
name[0] = min( base.length(), size_t(255) );
|
||||
strncpy( (char *)&name[1], base, name[0] );
|
||||
pb.volumeParam.ioNamePtr = name;
|
||||
pb.volumeParam.ioVolIndex = -1; // Use ioNamePtr to find the volume.
|
||||
|
||||
if( PBFlushVolSync(&pb) != noErr )
|
||||
LOG->Warn( "Failed to flush the memory card." );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
bool MemoryCardDriverThreaded_MacOSX::USBStorageDevicesChanged()
|
||||
|
||||
Reference in New Issue
Block a user