[R-SIG-Mac] help.start() and Safari etc

David Firth david.firth at nuffield.oxford.ac.uk
Wed Jul 16 11:24:20 MEST 2003


I have

 > options("browser")
$browser
[1] "/usr/bin/open"

and my default HTML browser in OS X is Safari (but it could be Omniweb 
or IE or whatever).

Problem: doing help.start() opens page
   file:///usr/local/lib/R/doc/html/index.html
AND it causes
   file:///usr/local/lib/R/doc/html/
to be the root for relative URLs from that page.  As a consequence the 
"Packages" link goes to the wrong page: it should go to the 
packages.html file in the per-session temporary directory, not the one 
in /usr/local/lib/R/doc/html/.

The problem seems to be that /usr/bin/open follows rather slavishly the 
links set up in the per-session directory: for example, when my R 
session makes temporary directory Rtmp536,
david% cd  /tmp/Rtmp536/.R/doc/html
david% ls -l
total 64
lrwxr-xr-x   1 david    wheel          31 Jul 16 08:45 R.css -> 
/usr/local/lib/R/doc/html/R.css
lrwxr-xr-x   1 david    wheel          36 Jul 16 08:45 about.html -> 
/usr/local/lib/R/doc/html/about.html
lrwxr-xr-x   1 david    wheel          34 Jul 16 08:45 faq.html -> 
/usr/local/lib/R/doc/html/faq.html
lrwxr-xr-x   1 david    wheel          39 Jul 16 08:45 function.html -> 
/usr/local/lib/R/doc/html/function.html
lrwxr-xr-x   1 david    wheel          36 Jul 16 08:45 index.html -> 
/usr/local/lib/R/doc/html/index.html
lrwxr-xr-x   1 david    wheel          34 Jul 16 08:45 left.jpg -> 
/usr/local/lib/R/doc/html/left.jpg
lrwxr-xr-x   1 david    wheel          34 Jul 16 08:45 logo.jpg -> 
/usr/local/lib/R/doc/html/logo.jpg
lrwxr-xr-x   1 david    wheel          36 Jul 16 08:45 logosm.jpg -> 
/usr/local/lib/R/doc/html/logosm.jpg
lrwxr-xr-x   1 david    wheel          44 Jul 16 08:45 
packages-head.html -> /usr/local/lib/R/doc/html/packages-head.html
-rw-r--r--   1 david    wheel        6208 Jul 16 08:45 packages.html
etc

I can't see a way around this using /usr/bin/open.

What would be useful is a command-line executable, say 
/usr/local/bin/safari, such that
david% safari /tmp/Rtmp536/.R/doc/html/index.html
works in much the same way as does
david% lynx /tmp/Rtmp536/.R/doc/html/index.html
i.e., it displays the material at 
file:///usr/local/lib/R/doc/html/index.html but keeps as the root for 
relative URLs the temporary directory file:///tmp/Rtmp536/.R/doc/html

But I don't know how to make such a "safari" script or other 
executable.  Any suggestions?

The same problem seems to occur with other browsers such as IE and 
Omniweb.

Regards,
David



More information about the R-SIG-Mac mailing list