Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix windows build
  • Loading branch information
jef-n committed Jan 7, 2013
1 parent 460f578 commit 314d144
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app/main.cpp
Expand Up @@ -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
}
}
}
Expand Down

2 comments on commit 314d144

@dakcarto
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.