[gdal-dev] Why Open() inside QuietDelete()?

Even Rouault even.rouault at spatialys.com
Thu Dec 14 08:59:41 PST 2023


Le 14/12/2023 à 17:36, Abel Pau via gdal-dev a écrit :
>
> Hi, today I have a very inside-code question...
>
> I’m wondering why when I want to translate from .SHP to MiraMonFile 
> (.PNT) and the destinatination file already exists I seems that the 
> call stack reveals a way that is weird for me and I would like to 
> understand:
>
> Translate->Create->(then, as it extist) QuietDelete ->Detele 
> ->Open.... *(why Open if I have to delete?)*
>
The answer lies in the code: 
https://github.com/OSGeo/gdal/blob/master/gcore/gdaldriver.cpp#L1642

The default Delete() implementation needs to know the file list 
composing the dataset (for example shapefile datasets are made of 
multiple files) by calling GDALDataset::GetFileList()

An alternative is that your driver implements the GDALDriver::pfnDelete 
callback, but I would do that only if the Open() in your driver is 
particularly slow (most drivers have a fast Open() method)

-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20231214/e13010f5/attachment.htm>


More information about the gdal-dev mailing list