From 42a162c9afc23fd68fdbe4f8519419ac4a57bff5 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 23 May 2023 14:26:52 +0200 Subject: Python: Use FilePath::searchInPath instead of Environment::findInPath That's the last remaining users. Change-Id: I14ce380b9c96b2197e478600a46ca725ed1acfbf Reviewed-by: David Schulz --- src/plugins/python/pythonutils.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/plugins/python/pythonutils.cpp') 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()) return interpreter->currentInterpreter().command; if (auto environmentAspect = runConfig->aspect()) - 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; -- cgit v1.2.3