aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/python/pythonutils.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2023-05-23 14:26:52 +0200
committerhjk <hjk@qt.io>2023-05-24 07:00:28 +0000
commit42a162c9afc23fd68fdbe4f8519419ac4a57bff5 (patch)
tree90d14c2a5fd08cc1c4db996e8fa729ff637f81fc /src/plugins/python/pythonutils.cpp
parentec9d9586fc199ea7b5f6cef0f0dbbe7025d62c26 (diff)
Python: Use FilePath::searchInPath instead of Environment::findInPath
That's the last remaining users. Change-Id: I14ce380b9c96b2197e478600a46ca725ed1acfbf Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/python/pythonutils.cpp')
-rw-r--r--src/plugins/python/pythonutils.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp
index bf3f683dd13..43d23a256bc 100644
--- a/src/plugins/python/pythonutils.cpp
+++ b/src/plugins/python/pythonutils.cpp
@@ -36,7 +36,7 @@ FilePath detectPython(const FilePath &documentPath)
if (!project)
project = ProjectManager::startupProject();
- Environment env = Environment::systemEnvironment();
+ FilePaths dirs = Environment::systemEnvironment().path();
if (project) {
if (auto target = project->activeTarget()) {
@@ -44,7 +44,7 @@ FilePath detectPython(const FilePath &documentPath)
if (auto interpreter = runConfig->aspect<InterpreterAspect>())
return interpreter->currentInterpreter().command;
if (auto environmentAspect = runConfig->aspect<EnvironmentAspect>())
- env = environmentAspect->environment();
+ dirs = environmentAspect->environment().path();
}
}
}
@@ -62,8 +62,9 @@ FilePath detectPython(const FilePath &documentPath)
if (defaultInterpreter.exists())
return defaultInterpreter;
- auto pythonFromPath = [=](const QString toCheck) {
- for (const FilePath &python : env.findAllInPath(toCheck)) {
+ auto pythonFromPath = [dirs](const FilePath &toCheck) {
+ const FilePaths found = toCheck.searchAllInDirectories(dirs);
+ for (const FilePath &python : found) {
// Windows creates empty redirector files that may interfere
if (python.exists() && python.osType() == OsTypeWindows && python.fileSize() != 0)
return python;