1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-19 15:29:42 +01:00

Merge pull request #71 from mickael9/master

Use AssocQueryString on Windows for script resolvers (untested)
This commit is contained in:
Christian Muehlhaeuser 2011-12-28 14:20:26 -08:00
commit 4341256594

View File

@ -30,6 +30,9 @@
#include "utils/tomahawkutils.h"
#include "utils/logger.h"
#ifdef Q_OS_WIN
#include <shlwapi.h>
#endif
ScriptResolver::ScriptResolver( const QString& exe )
: Tomahawk::ExternalResolverGui( exe )
@ -377,9 +380,26 @@ void ScriptResolver::startProcess()
QString runPath = filePath();
#ifdef Q_OS_WIN
if(fi.completeSuffix() == "py")
if ( fi.suffix().toLower() != "exe" )
{
interpreter = "python.exe";
DWORD dwSize = MAX_PATH;
wchar_t path[MAX_PATH] = { 0 };
wchar_t *ext = (wchar_t *) ("." + fi.suffix()).utf16();
HRESULT hr = AssocQueryStringW(
(ASSOCF) 0,
ASSOCSTR_EXECUTABLE,
ext,
L"open",
path,
&dwSize
);
if ( ! FAILED( hr ) )
{
interpreter = QString( "\"%1\"" ).arg(QString::fromUtf16((const ushort *) path));
}
}
else
{