forked from qt-creator/qt-creator
Python: Fix python run configuration
Add the WorkingDirectoryAspect to prevent running the main script in an unpredictable location. Change-Id: I1be206261b7983e933b53ccd57c93089154d8417 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
This commit is contained in:
@@ -274,6 +274,7 @@ PythonRunConfiguration::PythonRunConfiguration(Target *target, Core::Id id)
|
||||
|
||||
auto argumentsAspect = addAspect<ArgumentsAspect>();
|
||||
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<TerminalAspect>();
|
||||
|
||||
setCommandLineGetter([this, interpreterAspect, argumentsAspect] {
|
||||
@@ -305,6 +306,9 @@ void PythonRunConfiguration::updateLanguageServer()
|
||||
PyLSConfigureAssistant::instance()->openDocumentWithPython(python, document);
|
||||
}
|
||||
}
|
||||
|
||||
aspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(
|
||||
Utils::FilePath::fromString(mainScript()).parentDir());
|
||||
}
|
||||
|
||||
bool PythonRunConfiguration::supportsDebugger() const
|
||||
|
Reference in New Issue
Block a user