[R-pkg-devel] finding "logo.jpg" [was: "try" malfunctions on Ubuntu Linux 16.04 LTS, R-release, GCC]
El lun., 3 feb. 2020 20:30, Spencer Graves < spencer.graves at effectivedefense.org> escribi?:
Thanks to I?aki Ucar for identifying a second error that
explained why I still got an error after wrapping one in "try".
That still leaves a question of how to find a file like
"logo.jpg" in a platform independant way.
The following had worked for several years and now broke on rhub
"Ubuntu Linux 16.04 LTS, R-release, GCC" but not on several other
computers I tried:
logo.jpg <- paste(R.home(), "doc", "html", "logo.jpg", sep
= .Platform$file.sep)
On that Ubuntu platform, "readJPEG(logo.jpg)" stopped with "Error
in readJPEG(logo.jpg) : unable to open /usr/lib/R/doc/html/logo.jpg".
All these years you just got lucky that on CRAN the PNG is in that location. That's not the location in Fedora, and I'd say that's not the location in other distributions, because documentation is usually under /usr/share. But ultimately the test is faulty, because if the "try" call returns an error, then later you are trying to use an undefined object. I?aki