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

Abel Pau a.pau at creaf.uab.cat
Fri Dec 15 00:54:24 PST 2023


Thanks!!

De: Even Rouault <even.rouault at spatialys.com>
Enviado el: dijous, 14 de desembre de 2023 18:00
Para: Abel Pau <a.pau at creaf.uab.cat>; gdal-dev at lists.osgeo.org
Asunto: Re: [gdal-dev] Why Open() inside QuietDelete()?



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/20231215/181fb7d9/attachment-0001.htm>


More information about the gdal-dev mailing list