Ok. <br><br clear="all">Thanks.<br>Alejandro.<br>
<br><br><div class="gmail_quote">On 25 February 2010 11:57, Frank Warmerdam <span dir="ltr"><<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5">Alejandro Mostovoi wrote:<br>
> Hi All,<br>
> How can make OGRSFDriverRegistrar::Open fails when trying to open an<br>
> ESRI Shapefile and the first parameter "/pszName" has extension<br>
> different to "shp"/?<br>
><br>
> I know when extension is different to "shp", "dbf" and "shx" it fails,<br>
> but I need that also fails when extension is "dbf" or "shx".<br>
><br>
> Any idea?<br>
<br></div></div>
Alejandro,<br>
<br>
You could modify OGRShapeDataSource::Open() in<br>
gdal/ogr/ogrsf_frmts/shape/ogrshapedatasource.cpp so that is checks this.<br>
<br>
change:<br>
<br>
if( VSI_ISREG(stat.st_mode) )<br>
{<br>
if( !OpenFile( pszNewName, bUpdate, bTestOpen ) )<br>
<br>
to:<br>
<br>
if( VSI_ISREG(stat.st_mode) )<br>
{<br>
if( !EQUAL(CPLGetExtension(pszNewName),"shp")<br>
|| !OpenFile( pszNewName, bUpdate, bTestOpen ) )<br>
<br>
Best regards,<br><font color="#888888">
<br>
-- <br>
---------------------------------------+--------------------------------------<br>
I set the clouds in motion - turn up | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a><br>
light and sound - activate the windows | <a href="http://pobox.com/%7Ewarmerdam" target="_blank">http://pobox.com/~warmerdam</a><br>
and watch the world go round - Rush | Geospatial Programmer for Rent<br>
<br>
</font></blockquote></div><br>