mirror of https://github.com/libAthena/athena.git
Ensure FileWriter creates new files when overwrite unset
This commit is contained in:
parent
161206fdd9
commit
e253854269
|
@ -51,12 +51,26 @@ void FileWriter::open(bool overwrite)
|
||||||
if (overwrite)
|
if (overwrite)
|
||||||
m_fileHandle = _wfopen(m_filename.c_str(), L"w+b");
|
m_fileHandle = _wfopen(m_filename.c_str(), L"w+b");
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_fileHandle = _wfopen(m_filename.c_str(), L"r+b");
|
m_fileHandle = _wfopen(m_filename.c_str(), L"r+b");
|
||||||
|
if (m_fileHandle)
|
||||||
|
{
|
||||||
|
fclose(m_fileHandle);
|
||||||
|
m_fileHandle = _wfopen(m_filename.c_str(), L"r+b");
|
||||||
|
}
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
if (overwrite)
|
if (overwrite)
|
||||||
m_fileHandle = fopen(m_filename.c_str(), "w+b");
|
m_fileHandle = fopen(m_filename.c_str(), "w+b");
|
||||||
else
|
else
|
||||||
m_fileHandle = fopen(m_filename.c_str(), "r+b");
|
{
|
||||||
|
m_fileHandle = fopen(m_filename.c_str(), "a+b");
|
||||||
|
if (m_fileHandle)
|
||||||
|
{
|
||||||
|
fclose(m_fileHandle);
|
||||||
|
m_fileHandle = fopen(m_filename.c_str(), "r+b");
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!m_fileHandle)
|
if (!m_fileHandle)
|
||||||
|
|
Loading…
Reference in New Issue