DDNET_INFO(_TMP)

This commit is contained in:
Dennis Felsing 2018-08-23 09:57:35 +02:00
parent 29dd3e29f7
commit e295a121e4
3 changed files with 7 additions and 4 deletions

View file

@ -2230,7 +2230,7 @@ void CClient::ResetDDNetInfo()
void CClient::FinishDDNetInfo()
{
ResetDDNetInfo();
m_pStorage->RenameFile("ddnet-info.json.tmp", "ddnet-info.json", IStorage::TYPE_SAVE);
m_pStorage->RenameFile(DDNET_INFO_TMP, DDNET_INFO, IStorage::TYPE_SAVE);
LoadDDNetInfo();
}
@ -2775,7 +2775,7 @@ void CClient::Run()
m_Fifo.Init(m_pConsole, g_Config.m_ClInputFifo, CFGFLAG_CLIENT);
#endif
// loads the existing ddnet-info.json file if it exists
// loads the existing ddnet info file if it exists
LoadDDNetInfo();
// but still request the new one from server
if(g_Config.m_ClShowWelcome)
@ -3769,7 +3769,7 @@ void CClient::RequestDDNetInfo()
str_append(aUrl, aEscaped, sizeof(aUrl));
}
m_pDDNetInfoTask = std::make_shared<CGetFile>(Storage(), aUrl, "ddnet-info.json.tmp", IStorage::TYPE_SAVE, true);
m_pDDNetInfoTask = std::make_shared<CGetFile>(Storage(), aUrl, DDNET_INFO_TMP, IStorage::TYPE_SAVE, true);
Engine()->AddJob(m_pDDNetInfoTask);
}

View file

@ -1105,7 +1105,7 @@ int CServerBrowser::HasRank(const char *pMap)
void CServerBrowser::LoadDDNetInfoJson()
{
IStorage *pStorage = Kernel()->RequestInterface<IStorage>();
IOHANDLE File = pStorage->OpenFile("ddnet-info.json", IOFLAG_READ, IStorage::TYPE_SAVE);
IOHANDLE File = pStorage->OpenFile(DDNET_INFO, IOFLAG_READ, IStorage::TYPE_SAVE);
if(!File)
return;

View file

@ -7,6 +7,9 @@
#include "kernel.h"
#define DDNET_INFO "ddnet-info.json"
#define DDNET_INFO_TMP DDNET_INFO ".tmp"
/*
Structure: CServerInfo
*/