[Rd] source() chdir does not work (PR#7940)

From: <agalakhov_at_ifmlrs.uran.ru>
Date: Wed 15 Jun 2005 - 10:37:00 GMT


Full_Name: Alex Galakhov
Version: 2.1.0
OS: Linux (Debian)
Submission from: (NULL) (195.19.131.68)

After software upgrade source() does not work properly anymore. It completely ignores the chdir= parameter. This is because is.character(file) is always false after the assignment file<-file(file).

The fix is (written by hand in diff-like syntax, hopefully, you'll understand it):

 source<- function (blablabla) {
+filename <- file

...blablabla
-if (chdir && is.character (file) && ... dirname(file) ...) {
+if (chdir && is.character (filename) && ... dirname(filename) ...) {
+close(file) # since we can have only one on.exit(), we close file here
...blablabla
 on.exit(setwd(owd));
 }



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed Jun 15 20:45:24 2005

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:09 GMT