[gdal-dev] OGRSFDriverRegistrar question

Alejandro Mostovoi ahmostovoi at gmail.com
Thu Feb 25 10:49:59 EST 2010


Ok.

Thanks.
Alejandro.


On 25 February 2010 11:57, Frank Warmerdam <warmerdam at pobox.com> 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,
> warmerdam at pobox.com
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100225/ecd7a862/attachment.html


More information about the gdal-dev mailing list