Prevent accidental overwriting of replays in very rare cases while we wait for a better solution.
Refs #3255 This was SVN commit r17177.
This commit is contained in:
parent
f91478c730
commit
8f1853b8d8
@ -76,13 +76,16 @@ void CReplayLogger::StartGame(JS::MutableHandleValue attribs)
|
||||
// Append "-1", "-2" etc if we run multiple matches in a single session,
|
||||
// to avoid accidentally overwriting earlier logs.
|
||||
std::wstringstream name;
|
||||
name << getpid();
|
||||
|
||||
static int run = -1;
|
||||
if (++run)
|
||||
name << "-" << run;
|
||||
do
|
||||
{
|
||||
name << getpid();
|
||||
if (++run)
|
||||
name << "-" << run;
|
||||
|
||||
m_Directory = psLogDir() / L"sim_log" / name.str();
|
||||
} while (DirectoryExists(m_Directory));
|
||||
|
||||
m_Directory = psLogDir() / L"sim_log" / name.str();
|
||||
CreateDirectories(m_Directory, 0700);
|
||||
|
||||
m_Stream = new std::ofstream(OsString(m_Directory / L"commands.txt").c_str(), std::ofstream::out | std::ofstream::trunc);
|
||||
|
Loading…
Reference in New Issue
Block a user