[R-pkg-devel] About a need for hooks from R CMD ... commands, and a question

Dirk Eddelbuettel edd @ending from debi@n@org
Fri Jan 11 00:27:26 CET 2019


We have a winner! (By bending the rules.)

On 10 January 2019 at 16:44, Kyle Baron wrote:
| Will this work for you?
| 
| I had to stash the working directory (when R CMD build is run) in an
| environment variable via ~/.R/build.Renviron`
| 
| $ cat ~/.R/build.Renviron
| OLDWD=${PWD}
 
That is less unconditional that I desired, but it works.  

| But a Makefile tucked in vignettes directory will run and the two
| files will be there in the built package.  For me, I couldn't get
| OLDPWD so I saved it as OLDWD instead
| 
| $ tree vignettes/
| vignettes/
| ├── Makefile
| └── Untitled.Rmd
| 
| $ more vignettes/Makefile
| 
| all:
|         echo ${OLDWD} > ../inst/old.txt
|         echo ${PWD} > ../inst/current.txt
 
Then 'current.txt' is as before a temporary directory per R's build
conventions, but old.txt does indeed contain the source directory.

Close enought :)

Thanks very much for passing that creative hack along!

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-package-devel mailing list