1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-17 19:37:09 +02:00

Fix problems with reading files because of filename charsets.

This commit is contained in:
Dominik Schmidt
2011-01-16 17:41:38 +01:00
committed by Leo Franchi
parent b549ee24ac
commit f386de0f0d
3 changed files with 27 additions and 1 deletions

View File

@@ -160,7 +160,14 @@ MusicScanner::readFile( const QFileInfo& fi )
if( m_scanned % 100 == 0 )
qDebug() << "SCAN" << m_scanned << fi.absoluteFilePath();
TagLib::FileRef f( fi.absoluteFilePath().toUtf8().constData() );
#ifdef COMPLEX_TAGLIB_FILENAME
const wchar_t *encodedName = reinterpret_cast< const wchar_t *>(fi.absoluteFilePath().utf16());
#else
QByteArray fileName = QFile::encodeName( fi.absoluteFilePath() );
const char *encodedName = fileName.constData();
#endif
TagLib::FileRef f( encodedName );
if ( f.isNull() || !f.tag() )
{
// qDebug() << "Doesn't seem to be a valid audiofile:" << fi.absoluteFilePath();