fix screenshot filename searching if a file like "screen0.jpg" exists

This commit is contained in:
Glenn Maynard
2004-02-25 01:51:31 +00:00
parent 142be7ea83
commit 44e8427729
+12 -7
View File
@@ -1128,14 +1128,19 @@ CString SaveScreenshot( CString sDir, bool bSaveCompressed, bool bMakeSignature,
* is deleted, we won't fill in the hole (which makes screenshots hard to find). */
if( iIndex == -1 )
{
for( int i = files.size()-1; i >= 0; --i )
if( sscanf( files[i], "screen%d.%*s", &iIndex ) == 1 )
break;
iIndex = 0;
if( iIndex == -1 )
iIndex = 0;
else
++iIndex;
for( int i = files.size()-1; i >= 0; --i )
{
static Regex re( "^screen([0-9]{5})\\....$" );
vector<CString> matches;
if( !re.Compare( files[i], matches ) )
continue;
ASSERT( matches.size() == 1 );
iIndex = atoi( matches[0] )+1;
break;
}
}
//