[Qgis-user] QgsVectorFileWriter
Borys Jurgiel
borysiasty at aster.pl
Thu Jan 29 15:31:00 PST 2009
> > > In this way, it would be better to save in a temporary shapefile first,
> > > and if the process finishes successfully, remove the destination
> > > shapefile and copy the temporary shp to the new location.
> > >
> > hmm, I don't know about this...
> > Firstly, it's only useful to do this if you're concerned about the
> > initial file, but since you appear to be writing to a tmp directory,
> > this probably isn't all that critical...
> Sometimes I don't want to get 2 versions of a shp and select the source
> shp to be overwritten. If something goes wrong and the source is deleted
> first, all is lost...
I've implemented something very similar in the recent Table Manager:
1. save the modified layer to the temp directory
2. try to remove an old dbf~ backup if any (see the next point)
3. backup the original dbf file as dbf~
4. replace the original dbf with that one from the temp.
You can see it in the tableManager_gui.py file, method TableManager.doSave
(today they are lines 441-508)
More information about the Qgis-user
mailing list