1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-07 14:46:33 +02:00

* Fixed opening logfile with local8bit.

This commit is contained in:
Christian Muehlhaeuser
2014-09-18 09:05:48 +02:00
parent f4c05165dc
commit 684c1da4fe

View File

@@ -174,28 +174,28 @@ logFile()
void void
setupLogfile() setupLogfile()
{ {
if ( QFileInfo( logFile().toLocal8Bit() ).size() > LOGFILE_SIZE ) if ( QFileInfo( logFile() ).size() > LOGFILE_SIZE )
{ {
QByteArray lc; QByteArray lc;
{ {
QFile f( logFile().toLocal8Bit() ); QFile f( logFile() );
f.open( QIODevice::ReadOnly | QIODevice::Text ); f.open( QIODevice::ReadOnly | QIODevice::Text );
f.seek( f.size() - ( LOGFILE_SIZE - ( LOGFILE_SIZE / 4 ) ) ); f.seek( f.size() - ( LOGFILE_SIZE - ( LOGFILE_SIZE / 4 ) ) );
lc = f.readAll(); lc = f.readAll();
f.close(); f.close();
} }
QFile::remove( logFile().toLocal8Bit() ); QFile::remove( logFile() );
{ {
QFile f( logFile().toLocal8Bit() ); QFile f( logFile() );
f.open( QIODevice::WriteOnly | QIODevice::Text ); f.open( QIODevice::WriteOnly | QIODevice::Text );
f.write( lc ); f.write( lc );
f.close(); f.close();
} }
} }
logfile.open( logFile().toLocal8Bit(), ios::app ); logfile.open( logFile().toUtf8().constData(), ios::app );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 ) #if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
qInstallMessageHandler( TomahawkLogHandler ); qInstallMessageHandler( TomahawkLogHandler );
#else #else