forked from qt-creator/qt-creator
Python: ignore windows store redirectors
Change-Id: Ife5c13549d73156550a7ce4b5436f1e5a19503fa Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -74,13 +74,22 @@ FilePath detectPython(const FilePath &documentPath)
|
|||||||
if (defaultInterpreter.exists())
|
if (defaultInterpreter.exists())
|
||||||
return defaultInterpreter;
|
return defaultInterpreter;
|
||||||
|
|
||||||
const FilePath python3FromPath = env.searchInPath("python3");
|
auto pythonFromPath = [=](const QString toCheck) {
|
||||||
if (python3FromPath.exists())
|
for (const FilePath &python : env.findAllInPath(toCheck)) {
|
||||||
return python3FromPath;
|
// Windows creates empty redirector files that may interfere
|
||||||
|
if (python.exists() && python.osType() == OsTypeWindows && python.fileSize() != 0)
|
||||||
|
return python;
|
||||||
|
}
|
||||||
|
return FilePath();
|
||||||
|
};
|
||||||
|
|
||||||
const FilePath pythonFromPath = env.searchInPath("python");
|
const FilePath fromPath3 = pythonFromPath("python3");
|
||||||
if (pythonFromPath.exists())
|
if (fromPath3.exists())
|
||||||
return pythonFromPath;
|
return fromPath3;
|
||||||
|
|
||||||
|
const FilePath fromPath = pythonFromPath("python");
|
||||||
|
if (fromPath.exists())
|
||||||
|
return fromPath;
|
||||||
|
|
||||||
return PythonSettings::interpreters().value(0).command;
|
return PythonSettings::interpreters().value(0).command;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user