mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Use AssocQueryString on Windows for script resolvers
that are not .exe files (untested !)
This commit is contained in:
@@ -30,6 +30,9 @@
|
|||||||
#include "utils/tomahawkutils.h"
|
#include "utils/tomahawkutils.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
#include <shlwapi.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
ScriptResolver::ScriptResolver( const QString& exe )
|
ScriptResolver::ScriptResolver( const QString& exe )
|
||||||
: Tomahawk::ExternalResolverGui( exe )
|
: Tomahawk::ExternalResolverGui( exe )
|
||||||
@@ -377,9 +380,26 @@ void ScriptResolver::startProcess()
|
|||||||
QString runPath = filePath();
|
QString runPath = filePath();
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#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
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user