* Fixed a nice bug: If a game gets removed and is splitted it now also removes the wbf1, wbf2.... files and the folder.

* If a game gets removed it will remove the cover(s) with it
This commit is contained in:
overjoy.psm 2012-02-05 00:07:07 +00:00
parent 1218528c53
commit e90613f368
4 changed files with 25 additions and 6 deletions

View File

@ -148,13 +148,9 @@ void WBFS_Ext_ClosePart(wbfs_t* part)
s32 WBFS_Ext_RemoveGame(u8 *discid, char *gamepath)
{
//split_create(&split, gamepath, 0, 0, true);
//split_close(&split);
DIR *dir_iter;
struct dirent *ent;
char file[MAX_FAT_PATH];
char folder[MAX_FAT_PATH];
STRCOPY(folder, gamepath);
char *p = strrchr(folder, '/');
@ -167,8 +163,7 @@ s32 WBFS_Ext_RemoveGame(u8 *discid, char *gamepath)
if (ent->d_name[0] == '.') continue;
snprintf(file, sizeof(file), "%s/%s", folder, ent->d_name);
remove(file);
break;
remove(file);
}
closedir(dir_iter);
unlink(folder);

View File

@ -1860,3 +1860,25 @@ bool CMenu::MIOSisDML()
SAFE_FREE(TMD);
return false;
}
void CMenu::RemoveCover( char * id )
{
FILE *fp = fopen(fmt("%s/%s.png", m_boxPicDir.c_str(), id), "rb");
if (fp != 0)
{
SAFE_CLOSE(fp);
remove(fmt("%s/%s.png", m_boxPicDir.c_str(), id));
}
fp = fopen(fmt("%s/%s.png", m_picDir.c_str(), id), "rb");
if (fp != 0)
{
SAFE_CLOSE(fp);
remove(fmt("%s/%s.png", m_picDir.c_str(), id));
}
fp = fopen(fmt("%s/%s.wfc", m_cacheDir.c_str(), id), "rb");
if (fp != 0)
{
SAFE_CLOSE(fp);
remove(fmt("%s/%s.wfc", m_cacheDir.c_str(), id));
}
}

View File

@ -747,6 +747,7 @@ private:
const char *_domainFromView(void);
void UpdateCache(u32 view = COVERFLOW_MAX);
bool MIOSisDML();
void RemoveCover( char * id );
SFont _font(CMenu::FontSet &fontSet, const char *domain, const char *key, u32 fontSize, u32 lineSpacing, u32 weight, u32 index, const char *genKey);
STexture _texture(TexSet &texSet, const char *domain, const char *key, STexture def);
safe_vector<STexture> _textures(TexSet &texSet, const char *domain, const char *key);

View File

@ -191,6 +191,7 @@ bool CMenu::_wbfsOp(CMenu::WBFS_OP op)
break;
case CMenu::WO_REMOVE_GAME:
WBFS_RemoveGame((u8 *)m_cf.getId().c_str(), (char *) m_cf.getHdr()->path);
RemoveCover( (char *)m_cf.getId().c_str() );
m_btnMgr.show(m_wbfsPBar);
m_btnMgr.setProgress(m_wbfsPBar, 0.f, true);
m_btnMgr.setProgress(m_wbfsPBar, 1.f);