diff --git a/src/preferences/preferences.h b/src/preferences/preferences.h index 8434c7925..e37e5ad6b 100755 --- a/src/preferences/preferences.h +++ b/src/preferences/preferences.h @@ -1226,16 +1226,18 @@ public: } #ifdef Q_WS_WIN - static QString getPythonPath() { + static QString Preferences::getPythonPath() + { QString path = pythonSearchReg(USER); - if (path.isEmpty()) - path = pythonSearchReg(SYSTEM_32BIT); - else return path; + if (!path.isEmpty()) + return path; - if (path.isEmpty()) - path = pythonSearchReg(SYSTEM_64BIT); - else return path; + path = pythonSearchReg(SYSTEM_32BIT); + if (!path.isEmpty()) + return path; + + path = pythonSearchReg(SYSTEM_64BIT); if (!path.isEmpty()) return path; @@ -1243,10 +1245,11 @@ public: QStringList supported_versions; supported_versions << "32" << "31" << "30" << "27" << "26" << "25"; foreach (const QString &v, supported_versions) { - if (QFile::exists("C:/Python"+v+"/python.exe")) - return "C:\\Python"+v; + if (QFile::exists("C:/Python" + v + "/python.exe")) + return "C:/Python" + v; } - return QString::null; + + return QString(); } bool neverCheckFileAssoc() const { @@ -1361,120 +1364,123 @@ public: #ifdef Q_OS_WIN private: - enum REG_SEARCH_TYPE {USER, SYSTEM_32BIT, SYSTEM_64BIT}; - - static QStringList getRegSubkeys(const HKEY &handle) { - QStringList keys; - DWORD subkeys_count = 0; - DWORD max_subkey_len = 0; - long res = ::RegQueryInfoKey(handle, NULL, NULL, NULL, &subkeys_count, &max_subkey_len, NULL, NULL, NULL, NULL, NULL, NULL); - if (res == ERROR_SUCCESS) { - max_subkey_len++; //For null character - LPTSTR key_name = new TCHAR[max_subkey_len]; + enum REG_SEARCH_TYPE + { + USER, + SYSTEM_32BIT, + SYSTEM_64BIT + }; - for (uint i=0; i