mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 18:18:18 +00:00
Prevent temporary demo file from being deleted multiple times
Each time the client disconnected or stopped a demo, it tried to delete the previous temporary replay file, which causes an error message "could not delete file" to be shown in the console. This is prevented by clearing the current filename of the demo recorder after deleting the file.
This commit is contained in:
parent
f230ad0bdc
commit
a3e48bef27
|
@ -3978,7 +3978,10 @@ void CClient::DemoRecorder_Stop(int Recorder, bool RemoveFile)
|
||||||
{
|
{
|
||||||
const char *pFilename = m_aDemoRecorder[Recorder].GetCurrentFilename();
|
const char *pFilename = m_aDemoRecorder[Recorder].GetCurrentFilename();
|
||||||
if(pFilename[0] != '\0')
|
if(pFilename[0] != '\0')
|
||||||
|
{
|
||||||
Storage()->RemoveFile(pFilename, IStorage::TYPE_SAVE);
|
Storage()->RemoveFile(pFilename, IStorage::TYPE_SAVE);
|
||||||
|
m_aDemoRecorder[Recorder].ClearCurrentFilename();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ public:
|
||||||
|
|
||||||
bool IsRecording() const override { return m_File != nullptr; }
|
bool IsRecording() const override { return m_File != nullptr; }
|
||||||
char *GetCurrentFilename() override { return m_aCurrentFilename; }
|
char *GetCurrentFilename() override { return m_aCurrentFilename; }
|
||||||
|
void ClearCurrentFilename() { m_aCurrentFilename[0] = '\0'; }
|
||||||
|
|
||||||
int Length() const override { return (m_LastTickMarker - m_FirstTick) / SERVER_TICK_SPEED; }
|
int Length() const override { return (m_LastTickMarker - m_FirstTick) / SERVER_TICK_SPEED; }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue