[Gdal-dev] pre deleting for GDALDriver::Create() and CreateCopy()

Frank Warmerdam warmerdam at pobox.com
Sat Nov 10 14:44:51 EST 2007


Folks,

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 treated
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 with
an objection please let me know and we can discuss it at greater length.

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
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the gdal-dev mailing list