Skip to content

Commit

Permalink
Check for COMPLEX_TAGLIB_FILENAME
Browse files Browse the repository at this point in the history
Fixes crashes on Windows with files that can be indexed but not edited.
  • Loading branch information
xhochy authored and muesli committed Nov 8, 2014
1 parent 61bbe8d commit ee4675c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libtomahawk/filemetadata/MetadataEditor.cpp
Expand Up @@ -36,6 +36,7 @@
#include "Source.h"
#include "Typedefs.h"

#include "config.h"

#include <QDialog>
#include <QDialogButtonBox>
Expand Down Expand Up @@ -89,8 +90,12 @@ MetadataEditor::writeMetadata( bool closeDlg )
QFileInfo fi( QUrl( m_result->url() ).toLocalFile() );

bool changed = false;
#ifdef COMPLEX_TAGLIB_FILENAME
const wchar_t *encodedName = fi.canonicalFilePath().toStdWString().c_str();
#else
QByteArray fileName = QFile::encodeName( fi.canonicalFilePath() );
const char *encodedName = fileName.constData();
#endif

TagLib::FileRef f( encodedName );
QSharedPointer<Tomahawk::Tag> tag( Tomahawk::Tag::fromFile( f ) );
Expand Down

0 comments on commit ee4675c

Please sign in to comment.