diff --git a/src/accounts/spotify/SpotifyAccount.cpp b/src/accounts/spotify/SpotifyAccount.cpp index c4f2ba289..a14fbbb5d 100644 --- a/src/accounts/spotify/SpotifyAccount.cpp +++ b/src/accounts/spotify/SpotifyAccount.cpp @@ -52,8 +52,12 @@ static QPixmap* s_icon = 0; static QString s_resolverId = "spotify-osx"; #elif defined(Q_OS_WIN) static QString s_resolverId = "spotify-win"; +#elif defined(Q_OS_LINUX) && defined(__GNUC__) && defined(__x86_64__) +static QString s_resolverId = "spotify-linux-x64"; +#elif defined(Q_OS_LINUX) +static QString s_resolverId = "spotify-linux-x86"; #else -static QString s_resolverId = "spotify-linux"; +static QString s_resolverId = "spotify-unknown"; #endif Account* @@ -171,7 +175,7 @@ SpotifyAccount::checkForResolver() const QDir path = QCoreApplication::applicationDirPath(); QFile file( path.absoluteFilePath( "spotify_tomahawkresolver" ) ); return file.exists(); -#else if defined(Q_OS_WIN) +#elif defined(Q_OS_WIN) QDir appDataDir = TomahawkUtils::appDataDir(); return appDataDir.exists( QString( "atticaresolvers/%1/spotify_tomahawkresolver.exe" ).arg( s_resolverId ) ); #endif diff --git a/src/libtomahawk/AtticaManager.cpp b/src/libtomahawk/AtticaManager.cpp index 3d89a7593..c53c2377b 100644 --- a/src/libtomahawk/AtticaManager.cpp +++ b/src/libtomahawk/AtticaManager.cpp @@ -345,7 +345,11 @@ AtticaManager::binaryResolversList( BaseJob* j ) platform = "osx"; #elif defined(Q_OS_WIN) platform = "win"; -#endif +#elif defined(Q_OS_LINUX) && defined(__GNUC__) && defined(__x86_64__) + platform = "linux-x64"; +#elif defined(Q_OS_LINUX) // Horrible assumption here... + platform = "linux-x86"; + #endif foreach ( const Content& c, binaryResolvers ) { @@ -533,7 +537,7 @@ AtticaManager::payloadFetched() else { TomahawkUtils::extractBinaryResolver( f.fileName(), new BinaryInstallerHelper( resolverId, reply->property( "createAccount" ).toBool(), this ) ); - // Don't emit success or failed yet, helpre will do that. + // Don't emit success or failed yet, helper will do that. return; } } diff --git a/src/libtomahawk/utils/TomahawkUtils.cpp b/src/libtomahawk/utils/TomahawkUtils.cpp index 07471f42e..2db7ccb3b 100644 --- a/src/libtomahawk/utils/TomahawkUtils.cpp +++ b/src/libtomahawk/utils/TomahawkUtils.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -848,17 +849,6 @@ unzipFileInFolder( const QString &zipFileName, const QDir &folder ) void extractBinaryResolver( const QString& zipFilename, QObject* receiver ) { -#ifndef Q_OS_MAC - Q_UNUSED( zipFilename ); - Q_UNUSED( receiver ); -#endif - -#if !defined(Q_OS_MAC) && !defined (Q_OS_WIN) - Q_ASSERT( false ); - qWarning() << "NO SUPPORT YET FOR LINUX BINARY RESOLVERS!"; - return; -#endif - #ifdef Q_OS_MAC // Platform-specific handling of resolver payload now. We know it's good // Unzip the file. @@ -884,7 +874,9 @@ extractBinaryResolver( const QString& zipFilename, QObject* receiver ) qDebug() << "OS X: Copying binary resolver from to:" << src << dest; copyWithAuthentication( src, dest, receiver ); -#elif defined(Q_OS_WIN) + + return; +#elif defined(Q_OS_WIN) || defined(Q_OS_LINUX) // We unzip directly to the target location, just like normal attica resolvers Q_ASSERT( receiver ); if ( !receiver ) @@ -897,19 +889,28 @@ extractBinaryResolver( const QString& zipFilename, QObject* receiver ) return; const QDir resolverPath( extractScriptPayload( zipFilename, resolverId ) ); +#endif + +#ifdef Q_OS_WIN const QStringList files = resolverPath.entryList( QStringList() << "*.exe", QDir::Files ); +#elif defined(Q_OS_LINUX) + const QStringList files = resolverPath.entryList( QStringList() << "*_tomahawkresolver", QDir::Files ); +#endif + qDebug() << "Found executables in unzipped binary resolver dir:" << files; Q_ASSERT( files.size() == 1 ); if ( files.size() < 1 ) return; const QString resolverToUse = resolverPath.absoluteFilePath( files.first() ); - QMetaObject::invokeMethod(receiver, "installSucceeded", Qt::DirectConnection, Q_ARG( QString, resolverToUse ) ); +#ifdef Q_OS_LINUX + QProcess p; + p.start( "chmod", QStringList() << "744" << resolverToUse, QIODevice::ReadOnly ); + p.waitForFinished( 6000 ); #endif - // No support for binary resolvers on linux! Shouldn't even have been allowed to see/install.. - Q_ASSERT( false ); + QMetaObject::invokeMethod(receiver, "installSucceeded", Qt::DirectConnection, Q_ARG( QString, resolverToUse ) ); }