File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -273,10 +273,22 @@ void QgsGrassTools::runModule( QString name, bool direct )
273
273
{
274
274
#ifdef Q_OS_WIN
275
275
QgsGrass::putEnv ( " GRASS_HTML_BROWSER" , QgsGrassUtils::htmlBrowserPath () );
276
+ QStringList env;
277
+ QByteArray origPath = qgetenv ( " PATH" );
278
+ QByteArray origPythonPath = qgetenv ( " PYTHONPATH" );
279
+ QString path = QString ( origPath ) + QgsGrass::pathSeparator () + QgsGrass::grassModulesPaths ().join ( QgsGrass::pathSeparator () );
280
+ QString pythonPath = QString ( origPythonPath ) + QgsGrass::pathSeparator () + QgsGrass::getPythonPath ();
281
+ QgsDebugMsg ( " path = " + path );
282
+ QgsDebugMsg ( " pythonPath = " + pythonPath );
283
+ qputenv ( " PATH" , path.toLocal8Bit () );
284
+ qputenv ( " PYTHONPATH" , pythonPath.toLocal8Bit () );
285
+ // QProcess does not support environment for startDetached() -> set/reset to orig
276
286
if ( !QProcess::startDetached ( getenv ( " COMSPEC" ) ) )
277
287
{
278
288
QMessageBox::warning ( 0 , " Warning" , tr ( " Cannot start command shell (%1)" ).arg ( getenv ( " COMSPEC" ) ) );
279
289
}
290
+ qputenv ( " PATH" , origPath );
291
+ qputenv ( " PYTHONPATH" , origPythonPath );
280
292
return ;
281
293
#else
282
294
You can’t perform that action at this time.
0 commit comments