fix Windows prompts to insert disk if memory card not present

This commit is contained in:
Chris Danford
2003-11-09 11:50:28 +00:00
parent c98956653e
commit 3a9ce7be4d
3 changed files with 25 additions and 2 deletions
+22 -2
View File
@@ -163,9 +163,25 @@ bool ProfileManager::IsMemoryCardInserted( PlayerNumber pn )
sizeof(szFileSystemNameBuffer) );
return !!bResult;
}
#endif
#else
return true;
// Try to create directory before writing a temp file.
CreateDirectories( sDir );
// Test whether a memory card is usable by trying to write a file.
CString sFile = sDir + "temp";
FILE* fp = fopen( sFile, "w" );
if( fp )
{
fclose( fp );
remove( sFile );
return true;
}
else
{
return false;
}
#endif
}
bool ProfileManager::LoadProfileFromMemoryCard( PlayerNumber pn )
@@ -182,6 +198,10 @@ bool ProfileManager::LoadProfileFromMemoryCard( PlayerNumber pn )
bool ProfileManager::LoadFirstAvailableProfile( PlayerNumber pn )
{
// mount card
if( !PREFSMAN->m_sMemoryCardMountCommand[pn].empty() )
system( PREFSMAN->m_sMemoryCardMountCommand[pn] );
if( IsMemoryCardInserted(pn) )
{
if( LoadProfileFromMemoryCard(pn) )