mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
Also load .qgz files
This commit is contained in:
parent
d1fa1508c0
commit
bf2542e8ea
@ -5335,7 +5335,8 @@ void QgisApp::fileOpenAfterLaunch()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !projPath.endsWith( QLatin1String( ".qgs" ), Qt::CaseInsensitive ) )
|
if ( !projPath.endsWith( QLatin1String( ".qgs" ), Qt::CaseInsensitive ) &&
|
||||||
|
!projPath.endsWith( QLatin1String( ".qgz" ), Qt::CaseInsensitive ) )
|
||||||
{
|
{
|
||||||
messageBar()->pushMessage( autoOpenMsgTitle,
|
messageBar()->pushMessage( autoOpenMsgTitle,
|
||||||
tr( "Not valid project file: %1" ).arg( projPath ),
|
tr( "Not valid project file: %1" ).arg( projPath ),
|
||||||
|
@ -107,7 +107,8 @@ QFileInfo QgsServer::defaultProjectFile()
|
|||||||
QDir currentDir;
|
QDir currentDir;
|
||||||
fprintf( FCGI_stderr, "current directory: %s\n", currentDir.absolutePath().toUtf8().constData() );
|
fprintf( FCGI_stderr, "current directory: %s\n", currentDir.absolutePath().toUtf8().constData() );
|
||||||
QStringList nameFilterList;
|
QStringList nameFilterList;
|
||||||
nameFilterList << QStringLiteral( "*.qgs" );
|
nameFilterList << QStringLiteral( "*.qgs" )
|
||||||
|
<< QStringLiteral( "*.qgz" );
|
||||||
QFileInfoList projectFiles = currentDir.entryInfoList( nameFilterList, QDir::Files, QDir::Name );
|
QFileInfoList projectFiles = currentDir.entryInfoList( nameFilterList, QDir::Files, QDir::Name );
|
||||||
for ( int x = 0; x < projectFiles.size(); x++ )
|
for ( int x = 0; x < projectFiles.size(); x++ )
|
||||||
{
|
{
|
||||||
@ -211,7 +212,7 @@ bool QgsServer::init()
|
|||||||
QgsApplication::authManager()->init( QgsApplication::pluginPath(), QgsApplication::qgisAuthDatabaseFilePath() );
|
QgsApplication::authManager()->init( QgsApplication::pluginPath(), QgsApplication::qgisAuthDatabaseFilePath() );
|
||||||
|
|
||||||
QString defaultConfigFilePath;
|
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() )
|
if ( projectFileInfo.exists() )
|
||||||
{
|
{
|
||||||
defaultConfigFilePath = projectFileInfo.absoluteFilePath();
|
defaultConfigFilePath = projectFileInfo.absoluteFilePath();
|
||||||
|
@ -86,7 +86,7 @@ void usage( std::string const &appName )
|
|||||||
<< "\t[--help]\t\tthis text\n\n"
|
<< "\t[--help]\t\tthis text\n\n"
|
||||||
<< " FILES:\n"
|
<< " FILES:\n"
|
||||||
<< " Files specified on the command line can include rasters,\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"
|
<< " 1. Rasters - Supported formats include GeoTiff, DEM \n"
|
||||||
<< " and others supported by GDAL\n"
|
<< " and others supported by GDAL\n"
|
||||||
<< " 2. Vectors - Supported formats include ESRI Shapefiles\n"
|
<< " 2. Vectors - Supported formats include ESRI Shapefiles\n"
|
||||||
@ -471,11 +471,11 @@ int main( int argc, char *argv[] )
|
|||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
if ( myProjectFileName.isEmpty() )
|
if ( myProjectFileName.isEmpty() )
|
||||||
{
|
{
|
||||||
// check for a .qgs
|
// check for a .qgs or .qgz
|
||||||
for ( int i = 0; i < argc; i++ )
|
for ( int i = 0; i < argc; i++ )
|
||||||
{
|
{
|
||||||
QString arg = QDir::toNativeSeparators( QFileInfo( QFile::decodeName( argv[i] ) ).absoluteFilePath() );
|
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;
|
myProjectFileName = arg;
|
||||||
break;
|
break;
|
||||||
@ -525,8 +525,9 @@ int main( int argc, char *argv[] )
|
|||||||
{
|
{
|
||||||
QgsDebugMsg( QString( "Trying to load file : %1" ).arg( ( *myIterator ) ) );
|
QgsDebugMsg( QString( "Trying to load file : %1" ).arg( ( *myIterator ) ) );
|
||||||
QString myLayerName = *myIterator;
|
QString myLayerName = *myIterator;
|
||||||
// don't load anything with a .qgs extension - these are project files
|
// don't load anything with a .qgs or .qgz extension - these are project files
|
||||||
if ( !myLayerName.endsWith( QLatin1String( ".qgs" ), Qt::CaseInsensitive ) )
|
if ( !myLayerName.endsWith( QLatin1String( ".qgs" ), Qt::CaseInsensitive ) &&
|
||||||
|
!myLayerName.endsWith( QLatin1String( ".qgz" ), Qt::CaseInsensitive ) )
|
||||||
{
|
{
|
||||||
fprintf( stderr, "Data files not yet supported\n" );
|
fprintf( stderr, "Data files not yet supported\n" );
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user