Skip to content

Commit

Permalink
GDALDataItems / OGRDataItems: avoid listing .map and .dat files of a …
Browse files Browse the repository at this point in the history
….tab
  • Loading branch information
rouault committed Nov 12, 2017
1 parent 8cefb45 commit 96ec664
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/providers/gdal/qgsgdaldataitems.cpp
Expand Up @@ -171,6 +171,14 @@ QGISEXTERN QgsDataItem *dataItem( QString path, QgsDataItem *parentItem )
info.setFile( path );
QString name = info.fileName();

// If a .tab exists, then the corresponding .map/.dat is very likely a
// side-car file of the .tab
if ( suffix == QLatin1String( "map" ) || suffix == QLatin1String( "dat" ) )
{
if ( QFileInfo( QDir( info.path() ), info.baseName() + ".tab" ).exists() )
return nullptr;
}

QgsDebugMsgLevel( "path= " + path + " tmpPath= " + tmpPath + " name= " + name
+ " suffix= " + suffix + " vsiPrefix= " + vsiPrefix, 3 );

Expand Down
8 changes: 8 additions & 0 deletions src/providers/ogr/qgsogrdataitems.cpp
Expand Up @@ -517,6 +517,14 @@ QGISEXTERN QgsDataItem *dataItem( QString path, QgsDataItem *parentItem )
info.setFile( path );
QString name = info.fileName();

// If a .tab exists, then the corresponding .map/.dat is very likely a
// side-car file of the .tab
if ( suffix == QLatin1String( "map" ) || suffix == QLatin1String( "dat" ) )
{
if ( QFileInfo( QDir( info.path() ), info.baseName() + ".tab" ).exists() )
return nullptr;
}

QgsDebugMsgLevel( "thePath= " + path + " tmpPath= " + tmpPath + " name= " + name
+ " suffix= " + suffix + " vsiPrefix= " + vsiPrefix, 3 );

Expand Down

0 comments on commit 96ec664

Please sign in to comment.