Revision: 485
          http://rpy.svn.sourceforge.net/rpy/?rev=485&view=rev
Author:   warnes
Date:     2008-04-10 09:49:07 -0700 (Thu, 10 Apr 2008)

Log Message:
-----------
Use R's internal function to clean up R temporary directory for R 2.4.0 and 
later

Modified Paths:
--------------
    trunk/rpy/src/rpymodule.c

Modified: trunk/rpy/src/rpymodule.c
===================================================================
--- trunk/rpy/src/rpymodule.c   2008-04-10 13:45:34 UTC (rev 484)
+++ trunk/rpy/src/rpymodule.c   2008-04-10 16:49:07 UTC (rev 485)
@@ -1493,6 +1493,7 @@
   SEXP robj, e, index;
   PyObject *obj;
   int robjLen, sliceLen, c;
+  int ii;
   
   robjLen = Robj_len(a);
   
@@ -1529,7 +1530,7 @@
   /*   } */
   
   PROTECT(index = allocVector(INTSXP, sliceLen));
-  int ii;
+
   for (ii = 0; ii < sliceLen; ii++) {
     INTEGER_POINTER(index)[ii] = ii + ilow + 1;
   }
@@ -1777,17 +1778,22 @@
     R_dot_Last();           
     R_RunExitFinalizers();  
     CleanEd();              
-    KillAllDevices();       
+    KillAllDevices();
+
+#if (R_VERSION >= R_Version(2,4,0)) 
+    R_CleanTempDir();
+#else
     if((tmpdir = getenv("R_SESSION_TMPDIR"))) {          
 
-#ifdef _WIN32
+#   ifdef _WIN32
       snprintf((char *)buf, 1024, "rmdir /S /Q %s", tmpdir); 
-#else
+#   else
       snprintf((char *)buf, 1024, "rm -rf %s", tmpdir);
-#endif
+#   endif
 
       R_system((char *)buf);
     }
+#endif 
 
     PrintWarnings();   /* from device close and .Last */
     R_gc();  /* Remove any remaining R objects from memory */
@@ -1797,7 +1803,7 @@
 static PyObject *
 r_cleanup(void)
 {
-  r_cleanup();
+  r_finalize();
   Py_INCREF(Py_None);
   return Py_None;
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to