fixed crashes when ini, log, and cache files are read-only
This commit is contained in:
@@ -92,6 +92,10 @@ bool IniFile::ReadFile()
|
||||
void IniFile::WriteFile()
|
||||
{
|
||||
FILE* fp = fopen( path, "w" );
|
||||
|
||||
if( fp == NULL )
|
||||
return;
|
||||
|
||||
for (keymap::const_iterator k = keys.begin(); k != keys.end(); ++k)
|
||||
{
|
||||
if (k->second.empty())
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Notes.h"
|
||||
#include "RageUtil.h"
|
||||
#include "GameManager.h"
|
||||
#include "RageLog.h"
|
||||
|
||||
void NotesWriterSM::WriteGlobalTags(FILE *fp, const Song &out)
|
||||
{
|
||||
@@ -95,7 +96,10 @@ bool NotesWriterSM::Write(CString sPath, const Song &out, bool bSavingCache)
|
||||
|
||||
FILE* fp = fopen( sPath, "w" );
|
||||
if( fp == NULL )
|
||||
RageException::Throw( "Error opening song file '%s' for writing.", sPath.GetString() );
|
||||
{
|
||||
LOG->Warn( "Error opening song file '%s' for writing.", sPath.GetString() );
|
||||
return false;
|
||||
}
|
||||
|
||||
WriteGlobalTags(fp, out);
|
||||
if(bSavingCache) {
|
||||
|
||||
@@ -45,7 +45,8 @@ RageLog::~RageLog()
|
||||
{
|
||||
Flush();
|
||||
FreeConsole();
|
||||
fclose( m_fileLog );
|
||||
if( m_fileLog )
|
||||
fclose( m_fileLog );
|
||||
}
|
||||
|
||||
void RageLog::ShowConsole()
|
||||
@@ -68,7 +69,8 @@ void RageLog::Trace( const char *fmt, ...)
|
||||
CString sBuff = vssprintf( fmt, va );
|
||||
va_end(va);
|
||||
|
||||
fprintf( m_fileLog, "%s\n", sBuff.GetString() );
|
||||
if( m_fileLog )
|
||||
fprintf( m_fileLog, "%s\n", sBuff.GetString() );
|
||||
printf( "%s\n", sBuff.GetString() );
|
||||
CrashLog(sBuff);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user