@@ -130,12 +130,23 @@ QgsVectorFileWriter::QgsVectorFileWriter(
130
130
QString longName;
131
131
QString trLongName;
132
132
QString glob;
133
- QString ext ;
134
- if ( QgsVectorFileWriter::driverMetadata ( driverName, longName, trLongName, glob, ext ) )
133
+ QString exts ;
134
+ if ( QgsVectorFileWriter::driverMetadata ( driverName, longName, trLongName, glob, exts ) )
135
135
{
136
- if ( !vectorFileName.endsWith ( " ." + ext, Qt::CaseInsensitive ) )
136
+ QStringList allExts = exts.split ( " " , QString::SkipEmptyParts );
137
+ bool found = false ;
138
+ foreach ( QString ext, allExts )
137
139
{
138
- vectorFileName += " ." + ext;
140
+ if ( vectorFileName.endsWith ( " ." + ext, Qt::CaseInsensitive ) )
141
+ {
142
+ found = true ;
143
+ break ;
144
+ }
145
+ }
146
+
147
+ if ( !found )
148
+ {
149
+ vectorFileName += " ." + exts[0 ];
139
150
}
140
151
}
141
152
@@ -760,8 +771,8 @@ QMap<QString, QString> QgsVectorFileWriter::ogrDriverList()
760
771
QString longName;
761
772
QString trLongName;
762
773
QString glob;
763
- QString ext ;
764
- if ( QgsVectorFileWriter::driverMetadata ( drvName, longName, trLongName, glob, ext ) && !trLongName.isEmpty () )
774
+ QString exts ;
775
+ if ( QgsVectorFileWriter::driverMetadata ( drvName, longName, trLongName, glob, exts ) && !trLongName.isEmpty () )
765
776
{
766
777
resultMap.insert ( trLongName, drvName );
767
778
}
@@ -792,8 +803,8 @@ QString QgsVectorFileWriter::filterForDriver( const QString& driverName )
792
803
QString longName;
793
804
QString trLongName;
794
805
QString glob;
795
- QString ext ;
796
- if ( !driverMetadata ( driverName, longName, trLongName, glob, ext ) || trLongName.isEmpty () || glob.isEmpty () )
806
+ QString exts ;
807
+ if ( !driverMetadata ( driverName, longName, trLongName, glob, exts ) || trLongName.isEmpty () || glob.isEmpty () )
797
808
return " " ;
798
809
799
810
return trLongName + " [OGR] (" + glob.toLower () + " " + glob.toUpper () + " )" ;
@@ -897,7 +908,7 @@ bool QgsVectorFileWriter::driverMetadata( QString driverName, QString &longName,
897
908
longName = " Mapinfo File" ;
898
909
trLongName = QObject::tr ( " Mapinfo File" );
899
910
glob = " *.mif *.tab" ;
900
- ext = " mif" ;
911
+ ext = " mif tab " ;
901
912
}
902
913
else if ( driverName.startsWith ( " DGN" ) )
903
914
{
0 commit comments