mirror of
https://github.com/Heretek-AI/GDevelop.git
synced 2026-07-22 10:05:37 -04:00
54d7eb0662
Tried to correct the fact that SFML does not intercept events when used on a wxSFMLCanvas on linux by emulating these events. TODO: Test it Adapted to changes in GDCore. git-svn-id: svn://localhost@701 8062f311-0dae-4547-b526-b8ab9ac864a5
54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
#include <wx/config.h>
|
|
#include <wx/textfile.h>
|
|
#include <wx/log.h>
|
|
#include "LogFileManager.h"
|
|
#include "GDL/CommonTools.h"
|
|
|
|
LogFileManager *LogFileManager::_singleton = NULL;
|
|
|
|
void LogFileManager::WriteToLogFile(const std::string & log)
|
|
{
|
|
wxLogNull noLogPlease; //We take care of handling errors
|
|
|
|
if ( logActivated && !logFile.empty() )
|
|
{
|
|
wxTextFile file(logFile);
|
|
if ( file.Exists() )
|
|
{
|
|
if ( !file.Open() ) return; //Failed to open already existing log file
|
|
}
|
|
else
|
|
{
|
|
if ( !file.Create() ) return; //Failed to create log file
|
|
}
|
|
file.AddLine(log);
|
|
file.Write();
|
|
}
|
|
}
|
|
|
|
void LogFileManager::InitalizeFromConfig()
|
|
{
|
|
//Read configuration
|
|
wxConfig::Get()->Read("/Log/Activated", &logActivated, false);
|
|
wxString wxLogFile;
|
|
wxConfig::Get()->Read("/Log/File", &wxLogFile, "");
|
|
logFile = ToString(wxLogFile);
|
|
|
|
//Clear log
|
|
if ( logActivated && !logFile.empty() )
|
|
{
|
|
wxTextFile file(logFile);
|
|
if ( file.Exists() )
|
|
{
|
|
if ( !file.Open() ) return; //Failed to open already existing log file
|
|
|
|
file.Clear();
|
|
file.Write();
|
|
}
|
|
else
|
|
{
|
|
if ( !file.Create() ) return; //Failed to create log file
|
|
}
|
|
}
|
|
}
|