Skip to content
Permalink
Browse files

Also load .qgz files

  • Loading branch information
elpaso committed Jun 11, 2018
1 parent d1fa150 commit bf2542e8eafeccdaab3c6e223a0ed6c892ccf3b1
Showing with 11 additions and 8 deletions.
  1. +2 −1 src/app/qgisapp.cpp
  2. +3 −2 src/server/qgsserver.cpp
  3. +6 −5 tests/bench/main.cpp
@@ -5335,7 +5335,8 @@ void QgisApp::fileOpenAfterLaunch()
return;
}

if ( !projPath.endsWith( QLatin1String( ".qgs" ), Qt::CaseInsensitive ) )
if ( !projPath.endsWith( QLatin1String( ".qgs" ), Qt::CaseInsensitive ) &&
!projPath.endsWith( QLatin1String( ".qgz" ), Qt::CaseInsensitive ) )
{
messageBar()->pushMessage( autoOpenMsgTitle,
tr( "Not valid project file: %1" ).arg( projPath ),
@@ -107,7 +107,8 @@ QFileInfo QgsServer::defaultProjectFile()
QDir currentDir;
fprintf( FCGI_stderr, "current directory: %s\n", currentDir.absolutePath().toUtf8().constData() );
QStringList nameFilterList;
nameFilterList << QStringLiteral( "*.qgs" );
nameFilterList << QStringLiteral( "*.qgs" )
<< QStringLiteral( "*.qgz" );
QFileInfoList projectFiles = currentDir.entryInfoList( nameFilterList, QDir::Files, QDir::Name );
for ( int x = 0; x < projectFiles.size(); x++ )
{
@@ -211,7 +212,7 @@ bool QgsServer::init()
QgsApplication::authManager()->init( QgsApplication::pluginPath(), QgsApplication::qgisAuthDatabaseFilePath() );

QString defaultConfigFilePath;
QFileInfo projectFileInfo = defaultProjectFile(); //try to find a .qgs file in the server directory
QFileInfo projectFileInfo = defaultProjectFile(); //try to find a .qgs/.qgz file in the server directory
if ( projectFileInfo.exists() )
{
defaultConfigFilePath = projectFileInfo.absoluteFilePath();
@@ -86,7 +86,7 @@ void usage( std::string const &appName )
<< "\t[--help]\t\tthis text\n\n"
<< " FILES:\n"
<< " Files specified on the command line can include rasters,\n"
<< " vectors, and QGIS project files (.qgs): \n"
<< " vectors, and QGIS project files (.qgs or .qgz): \n"
<< " 1. Rasters - Supported formats include GeoTiff, DEM \n"
<< " and others supported by GDAL\n"
<< " 2. Vectors - Supported formats include ESRI Shapefiles\n"
@@ -471,11 +471,11 @@ int main( int argc, char *argv[] )
/////////////////////////////////////////////////////////////////////
if ( myProjectFileName.isEmpty() )
{
// check for a .qgs
// check for a .qgs or .qgz
for ( int i = 0; i < argc; i++ )
{
QString arg = QDir::toNativeSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() );
if ( arg.endsWith( QLatin1String( ".qgs" ), Qt::CaseInsensitive ) )
if ( arg.endsWith( QLatin1String( ".qgs" ), Qt::CaseInsensitive ) || arg.endsWith( QLatin1String( ".qgz" ), Qt::CaseInsensitive ) )
{
myProjectFileName = arg;
break;
@@ -525,8 +525,9 @@ int main( int argc, char *argv[] )
{
QgsDebugMsg( QString( "Trying to load file : %1" ).arg( ( *myIterator ) ) );
QString myLayerName = *myIterator;
// don't load anything with a .qgs extension - these are project files
if ( !myLayerName.endsWith( QLatin1String( ".qgs" ), Qt::CaseInsensitive ) )
// don't load anything with a .qgs or .qgz extension - these are project files
if ( !myLayerName.endsWith( QLatin1String( ".qgs" ), Qt::CaseInsensitive ) &&
!myLayerName.endsWith( QLatin1String( ".qgz" ), Qt::CaseInsensitive ) )
{
fprintf( stderr, "Data files not yet supported\n" );
return 1;

0 comments on commit bf2542e

Please sign in to comment.
You can’t perform that action at this time.