Ok. Thanks. Alejandro.
On 25 February 2010 11:57, Frank Warmerdam <[email protected]> wrote: > Alejandro Mostovoi wrote: > > Hi All, > > How can make OGRSFDriverRegistrar::Open fails when trying to open an > > ESRI Shapefile and the first parameter "/pszName" has extension > > different to "shp"/? > > > > I know when extension is different to "shp", "dbf" and "shx" it fails, > > but I need that also fails when extension is "dbf" or "shx". > > > > Any idea? > > Alejandro, > > You could modify OGRShapeDataSource::Open() in > gdal/ogr/ogrsf_frmts/shape/ogrshapedatasource.cpp so that is checks this. > > change: > > if( VSI_ISREG(stat.st_mode) ) > { > if( !OpenFile( pszNewName, bUpdate, bTestOpen ) ) > > to: > > if( VSI_ISREG(stat.st_mode) ) > { > if( !EQUAL(CPLGetExtension(pszNewName),"shp") > || !OpenFile( pszNewName, bUpdate, bTestOpen ) ) > > Best regards, > > -- > > ---------------------------------------+-------------------------------------- > I set the clouds in motion - turn up | Frank Warmerdam, > [email protected] > light and sound - activate the windows | > http://pobox.com/~warmerdam<http://pobox.com/%7Ewarmerdam> > and watch the world go round - Rush | Geospatial Programmer for Rent > >
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
