Simplify. Clear Cache/Banners, too (doesn't exist just yet).

This commit is contained in:
Glenn Maynard
2003-06-04 20:36:38 +00:00
parent c1be06d5dd
commit ababa26c17
+18 -8
View File
@@ -22,6 +22,22 @@ SongCacheIndex::~SongCacheIndex()
}
static void EmptyDir( CString dir )
{
ASSERT(dir[dir.size()-1] == '/');
CStringArray asCacheFileNames;
GetDirListing( dir, asCacheFileNames );
for( unsigned i=0; i<asCacheFileNames.size(); i++ )
{
if (0 == stricmp( asCacheFileNames[i], ".cvsignore" )) // don't delete .cvsignore files
continue;
remove( dir + asCacheFileNames[i] );
}
}
void SongCacheIndex::ReadCacheIndex()
{
CacheIndex.ReadFile(); // don't care if this fails
@@ -32,15 +48,9 @@ void SongCacheIndex::ReadCacheIndex()
return; /* OK */
LOG->Trace( "Cache format is out of date. Deleting all cache files." );
CStringArray asCacheFileNames;
GetDirListing( "Cache/*", asCacheFileNames );
for( unsigned i=0; i<asCacheFileNames.size(); i++ )
{
if (0 == stricmp( asCacheFileNames[i], ".cvsignore" )) // don't delete .cvsignore files
continue;
EmptyDir( "Cache/" );
EmptyDir( "Cache/Banners/" );
remove( "Cache/" + asCacheFileNames[i] );
}
CacheIndex.Reset();
}