Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #887 from sbrunner/environ_mapfile
Add QGIS_PROJECT_FILE environement option
  • Loading branch information
mhugent committed Sep 13, 2013
2 parents e7956a5 + ccda1c4 commit b14e133
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/mapserver/qgis_map_serv.cpp
Expand Up @@ -297,14 +297,22 @@ int main( int argc, char * argv[] )
//set admin config file to wms server object
QString configFilePath( defaultConfigFilePath );

paramIt = parameterMap.find( "MAP" );
if ( paramIt == parameterMap.constEnd() )
QString projectFile = getenv( "QGIS_PROJECT_FILE" );
if ( !projectFile.isEmpty() )
{
QgsDebugMsg( QString( "Using default configuration file path: %1" ).arg( defaultConfigFilePath ) );
configFilePath = projectFile;
}
else
{
configFilePath = paramIt.value();
paramIt = parameterMap.find( "MAP" );
if ( paramIt == parameterMap.constEnd() )
{
QgsDebugMsg( QString( "Using default configuration file path: %1" ).arg( defaultConfigFilePath ) );
}
else
{
configFilePath = paramIt.value();
}
}

QgsConfigParser* adminConfigParser = QgsConfigCache::instance()->searchConfiguration( configFilePath );
Expand Down

0 comments on commit b14e133

Please sign in to comment.