[winGRASS] v.db.addcol
Moritz Lennert
mlennert at club.worldonline.be
Sat Nov 10 06:28:39 EST 2007
On Sat, November 10, 2007 10:06, Glynn Clements wrote:
>
> Call remove() first.
>
I've found the following other places where I have the feeling that this
needs to be done, but would like confirmation that these are correct:
-------------------
general/g.setproj/main.c:
RCS file: /home/grass/grassrepository/grass6/general/g.setproj/main.c,v
retrieving revision 2.10
diff -u -r2.10 main.c
--- main.c 6 Aug 2007 15:21:21 -0000 2.10
+++ main.c 10 Nov 2007 11:17:42 -0000
@@ -330,6 +330,7 @@
*/
if (exist) {
sprintf(buff, "%s~", path);
+ remove(buff);
rename(path, buff);
}
if (Out_proj == 0)
@@ -487,6 +488,7 @@
*/
if (access(path, 0) == 0) {
sprintf(buff, "%s~", path);
+ remove(buff);
rename(path, buff);
}
if (Out_proj == 0)
------------------
---------------
lib/gis/rename.c:
RCS file: /home/grass/grassrepository/grass6/lib/gis/rename.c,v
retrieving revision 2.4
diff -u -r2.4 rename.c
--- rename.c 14 Apr 2007 23:02:00 -0000 2.4
+++ rename.c 10 Nov 2007 11:15:02 -0000
@@ -60,5 +60,6 @@
G__file_name (to, element, newname, mapset);
/* return result of rename */
+ remove(to);
return rename(from, to) == 0 ? 1 : -1;
}
--------------
One I don't know how to interpret what happens is this in lib/g3d/g3dclose.c:
/* finally move tempfile to data file */^M
G3d_filename (path, G3D_CELL_ELEMENT, map->fileName, map->mapset);^M
#ifdef __MINGW32__^M
if ( CopyFile ( map->tempName, path, FALSE ) == 0 ) {^M
#else^M
if (link (map->tempName, path) < 0) {^M
#endif^M
if(rename(map->tempName, path)) {^M
sprintf (buf,^M
"G3d_closeNew: can't move temp raster map %s\nto 3d data file
%s",^M
map->tempName, path);^M
G3d_error (buf);^M
return 0;^M
}^M
} else ^M
remove ( map->tempName );
CopyFile should already do the copying, why do we need a rename afterwards ?
Moritz
More information about the grass-windows
mailing list