Skip to content
Permalink
Browse files
Server: fix unreported project storage not supported with -p
-p only supported filesystem storage this PR fixes this
behavior by initializing providers before the project
is loaded and by attempting a project read instead of
just checking for the file.

Backported from master 545dcac
  • Loading branch information
elpaso authored and nyalldawson committed May 31, 2021
1 parent e2f4fc6 commit af9338291c192bbf977d7e2dec04e989f3793a29
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/server/qgis_mapserver.cpp
@@ -177,11 +177,14 @@ int main( int argc, char *argv[] )
qputenv( "QGIS_SERVER_LOG_LEVEL", logLevel.toUtf8() );
qputenv( "QGIS_SERVER_LOG_STDERR", "1" );

// Create server
QTcpServer tcpServer;

if ( ! parser.value( projectOption ).isEmpty( ) )
{
// Check it!
const QString projectFilePath { parser.value( projectOption ) };
if ( ! QFile::exists( projectFilePath ) )
if ( ! QgsProject::instance()->read( projectFilePath, QgsProject::ReadFlag::FlagDontResolveLayers | QgsProject::ReadFlag::FlagDontLoadLayouts | QgsProject::ReadFlag::FlagDontStoreOriginalStyles ) )
{
std::cout << QObject::tr( "Project file not found, the option will be ignored." ).toStdString() << std::endl;
}
@@ -194,8 +197,6 @@ int main( int argc, char *argv[] )
// Disable parallel rendering because if its internal loop
//qputenv( "QGIS_SERVER_PARALLEL_RENDERING", "0" );

// Create server
QTcpServer tcpServer;

QHostAddress address { QHostAddress::AnyIPv4 };
address.setAddress( ipAddress );

0 comments on commit af93382

Please sign in to comment.