mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
show an error popup when demo deletion fails
This commit is contained in:
parent
64e36b5095
commit
13902fef6c
|
@ -53,7 +53,6 @@ CMenus::CMenus()
|
|||
m_NeedSendinfo = false;
|
||||
m_MenuActive = true;
|
||||
m_UseMouseButtons = true;
|
||||
m_DemolistDelEntry = false;
|
||||
|
||||
m_EscapePressed = false;
|
||||
m_EnterPressed = false;
|
||||
|
@ -1034,7 +1033,19 @@ int CMenus::Render()
|
|||
if(DoButton_Menu(&s_ButtonTryAgain, Localize("Yes"), 0, &Yes) || m_EnterPressed)
|
||||
{
|
||||
m_Popup = POPUP_NONE;
|
||||
m_DemolistDelEntry = true;
|
||||
// delete demo
|
||||
if(m_DemolistSelectedIndex >= 0 && !m_DemolistSelectedIsDir)
|
||||
{
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
|
||||
if(Storage()->RemoveFile(aBuf, m_lDemos[m_DemolistSelectedIndex].m_StorageType))
|
||||
{
|
||||
DemolistPopulate();
|
||||
DemolistOnUpdate(false);
|
||||
}
|
||||
else
|
||||
PopupMessage(Localize("Error"), Localize("Unable to delete the demo"), Localize("Ok"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(m_Popup == POPUP_FIRST_LAUNCH)
|
||||
|
|
|
@ -180,7 +180,6 @@ class CMenus : public CComponent
|
|||
|
||||
sorted_array<CDemoItem> m_lDemos;
|
||||
char m_aCurrentDemoFolder[256];
|
||||
bool m_DemolistDelEntry;
|
||||
int m_DemolistSelectedIndex;
|
||||
bool m_DemolistSelectedIsDir;
|
||||
int m_DemolistStorageType;
|
||||
|
|
|
@ -477,22 +477,6 @@ void CMenus::RenderDemoList(CUIRect MainView)
|
|||
s_Inited = 1;
|
||||
}
|
||||
|
||||
// delete demo
|
||||
if(m_DemolistDelEntry)
|
||||
{
|
||||
if(m_DemolistSelectedIndex >= 0 && !m_DemolistSelectedIsDir)
|
||||
{
|
||||
char aBuf[512];
|
||||
str_format(aBuf, sizeof(aBuf), "%s/%s", m_aCurrentDemoFolder, m_lDemos[m_DemolistSelectedIndex].m_aFilename);
|
||||
if(Storage()->RemoveFile(aBuf, m_lDemos[m_DemolistSelectedIndex].m_StorageType))
|
||||
{
|
||||
DemolistPopulate();
|
||||
DemolistOnUpdate(false);
|
||||
}
|
||||
}
|
||||
m_DemolistDelEntry = false;
|
||||
}
|
||||
|
||||
char aFooterLabel[128] = {0};
|
||||
if(m_DemolistSelectedIndex >= 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue