@@ -79,6 +79,12 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
79
79
QgsDebugMsg ( " extensions: " + extensions.join ( " " ) );
80
80
QgsDebugMsg ( " wildcards: " + wildcards.join ( " " ) );
81
81
}
82
+ // skip *.aux.xml files (GDAL auxilary metadata files)
83
+ // unless that extension is in the list (*.xml might be though)
84
+ if ( thePath.right ( 8 ) == " .aux.xml" &&
85
+ extensions.indexOf ( " aux.xml" ) < 0 )
86
+ return 0 ;
87
+
82
88
if ( extensions.indexOf ( info.suffix ().toLower () ) < 0 )
83
89
{
84
90
bool matches = false ;
@@ -107,7 +113,8 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
107
113
108
114
QgsDebugMsg ( " GdalDataset opened " + thePath );
109
115
110
- QString name = info.completeBaseName ();
116
+ // extract basename with extension
117
+ QString name = info.completeBaseName () + " ." + QFileInfo ( thePath ).suffix ();
111
118
QString uri = thePath;
112
119
113
120
QgsLayerItem * item = new QgsGdalLayerItem ( parentItem, name, thePath, uri );
@@ -124,11 +131,10 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
124
131
if ( hChildDS )
125
132
{
126
133
GDALClose ( hChildDS );
127
- QgsDebugMsg ( QString ( " add child #%1 - %2" ).arg ( i ).arg ( sublayers[i] ) );
128
134
129
135
QString name = sublayers[i];
130
- name. replace ( thePath, QFileInfo ( thePath ). completeBaseName () );
131
-
136
+ // replace full path with basename+extension
137
+ name. replace ( thePath, QFileInfo ( thePath ). completeBaseName () + " . " + QFileInfo ( thePath ). suffix () );
132
138
childItem = new QgsGdalLayerItem ( item, name, thePath + " /" + name, sublayers[i] );
133
139
if ( childItem )
134
140
item->addChildItem ( childItem );
0 commit comments