[Gdal-dev] pre deleting for GDALDriver::Create() and CreateCopy()
ivan.lucena at pmldnet.com
Sat Nov 10 15:54:51 EST 2007
I have no objection. I actually ran into the same problem with a driver
that I wrote but I wasn't aware of GetFileList() so I implemented the
fix (delete associated files) on the Create method of the driver itself.
Your solution sounds great.
Frank Warmerdam wrote:
> Even noticed a problem that has been nagging the back of my mind as well.
> Currently gdal_translate will generally just blat over existing files
> without warnings or anything. The old file is replaced, and I'm fine with
> that. But, associated files (.wld, .aux.xml, .ovr, etc) are not cleaned up
> which can easily leave us in the position where an old support file is
> as applying to a new base file - quite possibly very inappropriately.
> To fix this, I have modified the GDALDriver::Create() and
> GDALDriver::CreateCopy() methods to first check if the dataset already
> exists. If so, it identifies the appropriate driver, and calls it's delete
> method. For drivers who properly know about their supporting files (see
> GetFileList()) this will result in supporting files getting cleaned up.
> This does a good job of cleaning up .aux.xml files for instance.
> This is a fairly significant behavioral change, and if there are people
> an objection please let me know and we can discuss it at greater length.
> Best regards,
More information about the gdal-dev