Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3f8a0e0

Browse filesBrowse files
authored
Merge pull request #120 from imrehg/config-path
Set working directory for config.R correctly even if setwd is set outside
2 parents cbd61a1 + ea734bc commit 3f8a0e0
Copy full SHA for 3f8a0e0

File tree

1 file changed

+9
-0
lines changed
Filter options

1 file changed

+9
-0
lines changed

‎tools/config.R

Copy file name to clipboardExpand all lines: tools/config.R
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,15 @@ if (!interactive()) {
574574
args <- commandArgs(TRUE)
575575
type <- args[[1]]
576576

577+
# preserve working directory
578+
owd <- getwd()
579+
on.exit(setwd(owd), add = TRUE)
580+
581+
# switch working directory to the calling scripts's directory as set
582+
# by the shell, in case the R working directory was set to something else
583+
basedir <- Sys.getenv("PWD", unset = ".")
584+
setwd(basedir)
585+
577586
# report start of execution
578587
package <- Sys.getenv("R_PACKAGE_NAME", unset = "<unknown>")
579588
fmt <- "** preparing to %s package '%s' ..."

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.