Skip to content

Commit

Permalink
[Browser] With GDAL 2.x, fix invalid detection of OGR VRT by GDAL pro…
Browse files Browse the repository at this point in the history
…vider, and fix broken detection of OGR VRT (fixes #16806)
  • Loading branch information
rouault committed Oct 20, 2017
1 parent 6d50b37 commit 2e87d32
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/providers/gdal/qgsgdaldataitems.cpp
Expand Up @@ -259,13 +259,13 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
// do not print errors, but write to debug
CPLPushErrorHandler( CPLQuietErrorHandler );
CPLErrorReset();
if ( ! GDALIdentifyDriver( TO8F( thePath ), nullptr ) )
GDALDriverH hDriver = GDALIdentifyDriver( TO8F( thePath ), nullptr );
CPLPopErrorHandler();
if ( !hDriver || GDALGetDriverShortName( hDriver ) == QString( "OGR_VRT" ) )
{
QgsDebugMsgLevel( "Skipping VRT file because root is not a GDAL VRT", 2 );
CPLPopErrorHandler();
return nullptr;
}
CPLPopErrorHandler();
}
// add the item
QStringList sublayers;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -2402,7 +2402,7 @@ QString createFilters( QString type )
{
myDirectoryDrivers += QObject::tr( "U.S. Census TIGER/Line" ) + ",TIGER;";
}
else if ( driverName.startsWith( "VRT" ) )
else if ( driverName.contains( "VRT" ) ) // match both GDAL 1.x "VRT" and GDAL 2.x "OGR_VRT"
{
myFileFilters += createFileFilter_( QObject::tr( "VRT - Virtual Datasource" ),
"*.vrt *.ovf" );
Expand Down

0 comments on commit 2e87d32

Please sign in to comment.