[GRASS-CVS] markus: grass6/lib/gis rename.c,2.4,2.4.2.1

grass at intevation.de grass at intevation.de
Thu Nov 29 08:30:08 EST 2007


Author: markus

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

Modified Files:
      Tag: releasebranch_6_3
	rename.c 
Log Message:
add G_rename_file function for renaming files on file system (merge from HEAD)

Index: rename.c
===================================================================
RCS file: /grassrepository/grass6/lib/gis/rename.c,v
retrieving revision 2.4
retrieving revision 2.4.2.1
diff -u -d -r2.4 -r2.4.2.1
--- rename.c	14 Apr 2007 23:02:00 -0000	2.4
+++ rename.c	29 Nov 2007 13:30:06 -0000	2.4.2.1
@@ -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