From 568950e63e07fe6f1840c4f7f8a05ef399de2dac Mon Sep 17 00:00:00 2001 From: sledgehammer999 Date: Tue, 21 Jul 2015 22:02:36 +0300 Subject: [PATCH] Don't use list of versions for the Python fallback detection on Windows Always pick the newest versions among those installed. --- src/core/preferences.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/preferences.cpp b/src/core/preferences.cpp index 561462b71..bb813bfbb 100644 --- a/src/core/preferences.cpp +++ b/src/core/preferences.cpp @@ -1760,11 +1760,12 @@ QString Preferences::getPythonPath() return path; // Fallback: Detect python from default locations - QStringList supported_versions; - supported_versions << "34" << "33" << "32" << "31" << "30" << "27" << "26" << "25"; - foreach (const QString &v, supported_versions) - if (QFile::exists("C:/Python" + v + "/python.exe")) - return "C:/Python" + v; + const QStringList dirs = QDir("C:/").entryList(QStringList("Python*"), QDir::Dirs, QDir::Name | QDir::Reversed); + foreach (const QString &dir, dirs) { + const QString path("C:/" + dir + "/python.exe"); + if (QFile::exists(path)) + return path; + } return QString(); }