You can't please everyone all the time, and in this case you cannot just
make the substitution as
1) some parts of Windows demand \
2) \ is a trail byte in some Japanese characters.
Why don't you just ensure that you don't use such paths for .libPaths()?
On Wed, 2 Mar 2005, Seth Falcon wrote:
Hi all,
I'm seeing an error on Windows when I try to install a package to a package
library path that starts with a digit. I can reproduce the error as follows
using R-devel from Feb 24 on Windows advanced server:
badLib = "c:\\badExample\\2\\foo"
dir.create(badLib, recursive=TRUE)
z = .libPaths()
z = .libPaths(c(badLib, z))
z
[1] "c:\\badExample\\2\\foo" "C:/falcon/sw/rw2010dev/library"
pkg = "c:\\falcon\\abind_1.1-0.zip"
install.packages(pkg, repos=NULL, lib=badLib)
package 'abind' successfully unpacked and MD5 sums checked
updating HTML package descriptions
Error in gsub("^URL: ../../../library", lib0, readLines(cfile)) :
invalid backreference 2 in regular expression
After looking at src/library/utils/R/windows/linkhtml.R, it seems the error
is that the "\\2" part of the path is interpreted by gsub as a back
reference.
Changing "\\" to "/" in the library path fixes this issue:
okLib = chartr("\\", "/", badLib)
z = .libPaths(okLib)
z
[1] "c:/badExample/2/foo" "C:/falcon/sw/rw2010dev/library"
install.packages(pkg, repos=NULL, lib=okLib)
package 'abind' successfully unpacked and MD5 sums checked
updating HTML package descriptions
So adding a call to chartr inside make.search.html would seem to be an
improvement (i.e, it looks good from here, but I haven't tested and
don't know if there are reasons why this would be a bad idea). OTOH,
maybe this should have already happened in the call to .libPaths()?
This came up because on the Windows server I'm using, tempdir() contains a
directory names "2" as part of the path --- and I want to be able to install
package to temporary package libraries for testing purposes.
+ seth
______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
--
Brian D. Ripley, [EMAIL PROTECTED]
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel