[GRASS-dev] db/drivers/dbf/tables.c contains call to 'mv'
Glynn Clements
glynn at gclements.plus.com
Tue Feb 27 15:08:52 EST 2007
Moritz Lennert wrote:
> >> On lines 313 and 324 db/drivers/dbf/tables.c contains a call to 'mv'. This
> >> fails under Windows as the command cannot be found.
> >>
> >> There is a #ifdef __MINGW32__ between the two calls. If this becomes true,
> >> do we still need the mv calls ?
> >
> > IMHO, that code (and the strikingly similar code in close_new() in
> > lib/gis/closecell.c) is bogus. It should just be using rename().
>
> Like this ?
Yes.
> I'll have to test on Windows tonight, now that the xdr problem is
> solved, but on GNU/Linux it works.
rename() is ANSI C, so there shouldn't be any portability issues (it's
already used in several other files).
> lib/gis/closecell.c does not use 'mv', so I guess it doesn't cause any
> problems in Windows, but I imagine you suggest to get rid of the
>
> #ifdef __MINGW32__
> if ( CopyFile ( fcb->temp_name, path, FALSE ) == 0 ) {
> #else
> if(link (fcb->temp_name, path) < 0) {
> #endif
Yes; again, this should just use rename().
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list