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.
  • Loading branch information
elpaso committed May 25, 2021
1 parent a13c655 commit 545dcacb23ef6e5e87d0328f3dd07b999023dd6d
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/server/qgis_mapserver.cpp
@@ -588,11 +588,13 @@ int main( int argc, char *argv[] )
qputenv( "QGIS_SERVER_LOG_LEVEL", logLevel.toUtf8() );
qputenv( "QGIS_SERVER_LOG_STDERR", "1" );

QgsServer server;

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;
}
@@ -606,8 +608,6 @@ int main( int argc, char *argv[] )
//qputenv( "QGIS_SERVER_PARALLEL_RENDERING", "0" );


QgsServer server;

#ifdef HAVE_SERVER_PYTHON_PLUGINS
server.initPython();
#endif

0 comments on commit 545dcac

Please sign in to comment.