Skip to content

Commit

Permalink
[GRASS] fixed shell on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Oct 19, 2015
1 parent 1582f6a commit bcf10f9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/plugins/grass/qgsgrasstools.cpp
Expand Up @@ -273,10 +273,22 @@ void QgsGrassTools::runModule( QString name, bool direct )
{
#ifdef Q_OS_WIN
QgsGrass::putEnv( "GRASS_HTML_BROWSER", QgsGrassUtils::htmlBrowserPath() );
QStringList env;
QByteArray origPath = qgetenv( "PATH" );
QByteArray origPythonPath = qgetenv( "PYTHONPATH" );
QString path = QString( origPath ) + QgsGrass::pathSeparator() + QgsGrass::grassModulesPaths().join( QgsGrass::pathSeparator() );
QString pythonPath = QString( origPythonPath ) + QgsGrass::pathSeparator() + QgsGrass::getPythonPath();
QgsDebugMsg( "path = " + path );
QgsDebugMsg( "pythonPath = " + pythonPath );
qputenv( "PATH", path.toLocal8Bit() );
qputenv( "PYTHONPATH", pythonPath.toLocal8Bit() );
// QProcess does not support environment for startDetached() -> set/reset to orig
if ( !QProcess::startDetached( getenv( "COMSPEC" ) ) )
{
QMessageBox::warning( 0, "Warning", tr( "Cannot start command shell (%1)" ).arg( getenv( "COMSPEC" ) ) );
}
qputenv( "PATH", origPath );
qputenv( "PYTHONPATH", origPythonPath );
return;
#else

Expand Down

0 comments on commit bcf10f9

Please sign in to comment.