Skip to content

Commit d5a4a56

Browse files
author
g_j_m
committed
eliminate the OGR message about not being able to open a read-only
.shp file (if it is read-only, qgis then tries to open it read-only, so the OGR error message is unnecessary). git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5617 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 7f9b89a commit d5a4a56

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/providers/ogr/qgsogrprovider.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,13 @@ QgsOgrProvider::QgsOgrProvider(QString const & uri)
8888

8989
QgsDebugMsg("Data source uri is " + uri);
9090

91-
// try to open for update
91+
// try to open for update, but disable error messages to avoid a
92+
// message if the file is read only, because we cope with that
93+
// ourselves.
94+
CPLPushErrorHandler(&CPLQuietErrorHandler);
9295
ogrDataSource = OGRSFDriverRegistrar::Open(QFile::encodeName(uri).constData(), TRUE, &ogrDriver);
96+
CPLPopErrorHandler();
97+
9398
if(ogrDataSource == NULL)
9499
{
95100
// try to open read-only

0 commit comments

Comments
 (0)