[GRASS-CVS] moritz: grass6/lib/gis rename.c,2.4,2.5

grass at intevation.de grass at intevation.de
Fri Nov 23 15:51:15 EST 2007


Author: moritz

Update of /grassrepository/grass6/lib/gis
In directory doto:/tmp/cvs-serv24816

Modified Files:
	rename.c 
Log Message:
add G_rename_file function for renaming files on file system


Index: rename.c
===================================================================
RCS file: /grassrepository/grass6/lib/gis/rename.c,v
retrieving revision 2.4
retrieving revision 2.5
diff -u -d -r2.4 -r2.5
--- rename.c	14 Apr 2007 23:02:00 -0000	2.4
+++ rename.c	23 Nov 2007 20:51:13 -0000	2.5
@@ -19,6 +19,30 @@
 
 
 /**
+ **\fn int G_rename_file (char *oldname, char *newname)
+ **
+ **\brief Rename a file in the filesystem.
+ **
+ **The file or directory <b>oldname</b> is renamed to <b>newname</b>.<br>
+ **
+ **
+ ** \param[in] oldname
+ ** \param[in] newname
+ ** \return 0 if successful
+ ** \return -1 on error
+ **/
+
+int G_rename_file ( const char *oldname, const char *newname )
+{
+
+    #ifdef __MINGW32__
+      remove(oldname);
+    #endif
+
+    return rename(oldname, newname); 
+}
+
+/**
  * \fn int G_rename (char *element, char *oldname, char *newname)
  *
  * \brief Rename a database file.
@@ -60,5 +84,5 @@
     G__file_name (to, element, newname, mapset);
 
     /* return result of rename */
-    return rename(from, to) == 0 ? 1 : -1;
+    return G_rename_file(from, to) == 0 ? 1 : -1;
 }




More information about the grass-commit mailing list