Do not refresh rom browser if failed to get rom list

This commit is contained in:
zilmar 2012-10-04 11:44:32 +10:00
parent c291ab8457
commit 5e4fa4a371
2 changed files with 10 additions and 6 deletions

View File

@ -503,21 +503,21 @@ bool CRomBrowser::FillRomInfo(ROM_INFO * pRomInfo) {
return true; return true;
} }
} }
void CRomBrowser::GetRomFileNames( strlist & FileList, CPath & BaseDirectory, stdstr & Directory, bool InWatchThread )
{
bool CRomBrowser::GetRomFileNames( strlist & FileList, CPath & BaseDirectory, stdstr & Directory, bool InWatchThread )
{
CPath SearchPath((const stdstr&)BaseDirectory,"*.*"); CPath SearchPath((const stdstr&)BaseDirectory,"*.*");
SearchPath.AppendDirectory(Directory.c_str()); SearchPath.AppendDirectory(Directory.c_str());
if (!SearchPath.FindFirst(CPath::_A_ALLFILES)) if (!SearchPath.FindFirst(CPath::_A_ALLFILES))
{ {
return; return false;
} }
do { do {
if (InWatchThread && WaitForSingleObject(m_WatchStopEvent,0) != WAIT_TIMEOUT) if (InWatchThread && WaitForSingleObject(m_WatchStopEvent,0) != WAIT_TIMEOUT)
{ {
return; return false;
} }
if (SearchPath.IsDirectory()) if (SearchPath.IsDirectory())
@ -531,6 +531,7 @@ void CRomBrowser::GetRomFileNames( strlist & FileList, CPath & BaseDirectory, st
AddFileNameToList(FileList, Directory, SearchPath); AddFileNameToList(FileList, Directory, SearchPath);
} }
} while (SearchPath.FindNext()); } while (SearchPath.FindNext());
return true;
} }
void CRomBrowser::NotificationCB ( LPCSTR Status, CRomBrowser * _this ) void CRomBrowser::NotificationCB ( LPCSTR Status, CRomBrowser * _this )
@ -1659,7 +1660,10 @@ bool CRomBrowser::RomDirNeedsRefresh ( void )
//Get Current MD5 of file names //Get Current MD5 of file names
strlist FileNames; strlist FileNames;
GetRomFileNames(FileNames,CPath(_Settings->LoadString(Directory_Game)),stdstr(""), InWatchThread ); if (!GetRomFileNames(FileNames,CPath(_Settings->LoadString(Directory_Game)),stdstr(""), InWatchThread ))
{
return false;
}
FileNames.sort(); FileNames.sort();
MD5 NewMd5 = RomListHash(FileNames); MD5 NewMd5 = RomListHash(FileNames);

View File

@ -158,7 +158,7 @@ class CRomBrowser
void RomList_OpenRom ( DWORD pnmh ); void RomList_OpenRom ( DWORD pnmh );
void RomList_PopupMenu ( DWORD pnmh ); void RomList_PopupMenu ( DWORD pnmh );
void RomList_SortList ( void ); void RomList_SortList ( void );
void GetRomFileNames ( strlist & FileList, CPath & BaseDirectory, stdstr & Directory, bool InWatchThread ); bool GetRomFileNames ( strlist & FileList, CPath & BaseDirectory, stdstr & Directory, bool InWatchThread );
MD5 RomListHash ( strlist & FileList ); MD5 RomListHash ( strlist & FileList );
static void __stdcall NotificationCB ( LPCSTR Status, CRomBrowser * _this ); static void __stdcall NotificationCB ( LPCSTR Status, CRomBrowser * _this );