| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/path.R |
| 3 |
\name{with_path} |
| 4 |
\alias{with_path} |
| 5 |
\alias{local_path} |
| 6 |
\title{PATH environment variable} |
| 7 |
\usage{ |
| 8 |
with_path(new, code, action = c("prefix", "suffix", "replace")) |
| 9 |
|
| 10 |
local_path( |
| 11 |
new = list(), |
| 12 |
action = c("prefix", "suffix", "replace"), |
| 13 |
.local_envir = parent.frame() |
| 14 |
) |
| 15 |
} |
| 16 |
\arguments{ |
| 17 |
\item{new}{\verb{[character]}\cr New \code{PATH} entries} |
| 18 |
|
| 19 |
\item{code}{\code{[any]}\cr Code to execute in the temporary environment} |
| 20 |
|
| 21 |
\item{action}{\verb{[character(1)]}\cr Should new values \code{"replace"}, \code{"prefix"} |
| 22 |
(the default) or \code{"suffix"} existing paths} |
| 23 |
|
| 24 |
\item{.local_envir}{\verb{[environment]}\cr The environment to use for scoping.} |
| 25 |
} |
| 26 |
\value{ |
| 27 |
\code{[any]}\cr The results of the evaluation of the \code{code} |
| 28 |
argument. |
| 29 |
} |
| 30 |
\description{ |
| 31 |
Temporarily change the system search path. |
| 32 |
} |
| 33 |
\examples{ |
| 34 |
# temporarily modify the system PATH, *prefixing* the current path |
| 35 |
with_path(getwd(), Sys.getenv("PATH")) |
| 36 |
# temporarily modify the system PATH, *appending* to the current path |
| 37 |
with_path(getwd(), Sys.getenv("PATH"), "suffix") |
| 38 |
} |
| 39 |
\seealso{ |
| 40 |
\code{\link{withr}} for examples |
| 41 |
|
| 42 |
\code{\link[=Sys.setenv]{Sys.setenv()}} |
| 43 |
} |