From 364288b79cfb27f4bea9a7a41b785660fb8d0dde Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 16 Sep 2020 12:02:49 +0200 Subject: [PATCH] Python: Fix loading working directory Fixes: QTCREATORBUG-24440 Change-Id: I27a543f764e285acf678427cc909d2a95e5cb322 Reviewed-by: Christian Stenger --- src/plugins/python/pythonrunconfiguration.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/python/pythonrunconfiguration.cpp b/src/plugins/python/pythonrunconfiguration.cpp index 4d9b12cdc8e..6ec33ca87f6 100644 --- a/src/plugins/python/pythonrunconfiguration.cpp +++ b/src/plugins/python/pythonrunconfiguration.cpp @@ -281,6 +281,7 @@ PythonRunConfiguration::PythonRunConfiguration(Target *target, Utils::Id id) const QString script = bti.targetFilePath.toUserOutput(); setDefaultDisplayName(tr("Run %1").arg(script)); scriptAspect->setValue(script); + aspect()->setDefaultWorkingDirectory(bti.targetFilePath.parentDir()); }); connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update); @@ -298,9 +299,6 @@ void PythonRunConfiguration::updateLanguageServer() PyLSConfigureAssistant::instance()->openDocumentWithPython(python, document); } } - - aspect()->setDefaultWorkingDirectory( - Utils::FilePath::fromString(mainScript()).parentDir()); } bool PythonRunConfiguration::supportsDebugger() const