Bug 14826 - srcfilecopy does not save wd
srcfilecopy does not save wd
Status: RESOLVED FIXED
Product: R
Classification: Unclassified
Component: Misc
R 2.14.1 patched
All All
: P5 normal
Assigned To: R-core
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-24 19:44 UTC by Stephan Wahlbrink
Modified: 2012-02-27 21:11 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Wahlbrink 2012-02-24 19:44:27 UTC
In contrast to 'srcfile', 'srcfilecopy' does not save the working directory in 'wd'. So it is hard to find the original file later, if it was specified by a relative path.

'srcfilecopy' is used for example in the 'source' function.
Comment 1 Duncan Murdoch 2012-02-27 21:11:29 UTC
srcfilecopy() can also get its text from something that is not a file, and the debugger should not go looking in some directory in that case.  

I've fixed this in R-devel by adding the working directory as requested, and also adding an argument "isFile" and a field to the result to record whether the source is known to come from a file.  If isFile = TRUE, the debugger should be able to trust that the filename and wd fields really correspond to the source file; if not, they probably don't -- there may be no actual source file, or it may have a different name, and we've just got the name of a connection that read it.