From 6609d3e89fb7d7cbbcc2f3900972c70d36044ce6 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Sun, 1 Mar 2015 21:00:00 +0100 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 438b2f5b3..7841ab0dd 100644 --- a/src/core/preferences.cpp +++ b/src/core/preferences.cpp @@ -1763,11 +1763,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(); }