Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #7221 from elpaso/load-qgz
[bugfix] Also load .qgz files
- Loading branch information
Showing
with
11 additions
and
8 deletions.
-
+2
−1
src/app/qgisapp.cpp
-
+3
−2
src/server/qgsserver.cpp
-
+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; |
|
|