Navigation Menu

Skip to content

Commit

Permalink
Server: fix unreported project storage not supported with -p
Browse files Browse the repository at this point in the history
-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 545dcac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/server/qgis_mapserver.cpp
Expand Up @@ -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;
}
Expand All @@ -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
Expand Down

0 comments on commit 545dcac

Please sign in to comment.