Skip to content
Permalink
Browse files
fix windows build
  • Loading branch information
jef-n committed Jan 7, 2013
1 parent 460f578 commit 314d144b4dc2ddba991cfd796550f26fa026aa64
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/app/main.cpp
@@ -604,11 +604,20 @@ int main( int argc, char *argv[] )

if ( systemEnvVars.contains( envVarName ) && envVarApply == "unset" )
{
#ifdef Q_WS_WIN
putenv( envVarName.toUtf8().constData() );
#else
unsetenv( envVarName.toUtf8().constData() );
#endif
}
else
{
#ifdef Q_WS_WIN
if ( envVarApply != "undefined" || !getenv( envVarName.toUtf8().constData() ) )
putenv( QString( "%1=%2" ).arg( envVarName ).arg( envVarValue ).toUtf8().constData() );
#else
setenv( envVarName.toUtf8().constData(), envVarValue.toUtf8().constData(), envVarApply == "undefined" ? 0 : 1 );
#endif
}
}
}

2 comments on commit 314d144

@dakcarto

This comment has been minimized.

Copy link
Member

@dakcarto dakcarto replied Jan 13, 2013

Thanks Juergen! I had not noticed this commit and was just drafting a feature request to ask a Windows developer to add this functionality, when I finally ran across it.

Do you think envVarName.toUtf8() should be switched to envVarName.toLocal8Bit(), or maybe envVarName.toAscii() ? I think envVarValue.toUtf8().constData() makes sense. I'm not just not sure (not enough experience to know) if UTF8 is supported at this level for all operating systems running QGIS. Pretty sure it is for Linux and Mac.

@dakcarto

This comment has been minimized.

Copy link
Member

@dakcarto dakcarto replied Jan 13, 2013

The reason I mention the possible change is that there has been an issue where the custom variables appear to not work on Windows, even for an administrator user:
http://hub.qgis.org/issues/6961

Regis tested with a build several commits after this one.

Please sign in to comment.