Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when a second call to the function system.file exists within app_config() #1179

Open
LDSamson opened this issue Sep 9, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@LDSamson
Copy link

LDSamson commented Sep 9, 2024

Related to #1178

To Reproduce

  1. Add a function with a call to system.file() to app_config.R in a new golem project. (or even just a comment with the word system.file() in it)
  2. run golem::document_and_reload()

The following error will occur:

Error in if (grepl(package_name, where_system.file)) { : 
  the condition has length > 1

This happens because in check_name_consistency, the internally set package name is retrieved by performing a regex search for the word system.file within app_config.R and checking the name consistency; this check will error if multiple lines are returned by the regex search:

golem/R/reload.R

Lines 45 to 58 in 6291796

where_system.file <- app_config[
grep(
"system.file",
app_config
)
]
setwd(old_dir)
if (grepl(
package_name,
where_system.file
)) {
return(invisible(TRUE))

Background information
I came across this problem by trying to circumvent #1178 ; I replaced a call to app_sys() in the file argument of get_golem_config to Sys.getenv("CONFIG_PATH", system.file("golem-config.yml", package = "test_golemapp")).

Session Info version R version 4.4.1 (2024-06-14 ucrt) os Windows 11 x64 (build 22631) system x86_64, mingw32 ui RStudio language en collate German_Germany.utf8 ctype German_Germany.utf8 tz Europe/Berlin date 2024-09-09 rstudio 2024.04.2+764 Chocolate Cosmos (desktop) pandoc NA

─ Packages ! package * version date (UTC) lib source
P attempt 0.3.1 2020-05-03 [?] RSPM
P cachem 1.1.0 2024-05-16 [?] RSPM
P cli 3.6.3 2024-06-21 [?] CRAN (R 4.4.1)
P config 0.3.2 2023-08-30 [?] RSPM
P devtools 2.4.5 2022-10-11 [?] RSPM
P digest 0.6.37 2024-08-19 [?] RSPM
P ellipsis 0.3.2 2021-04-29 [?] RSPM
P fastmap 1.2.0 2024-05-15 [?] RSPM
P fs 1.6.4 2024-04-25 [?] RSPM (R 4.4.0)
P glue 1.7.0 2024-01-09 [?] RSPM (R 4.4.0)
P golem 0.5.1 2024-08-27 [?] RSPM
P htmltools 0.5.8.1 2024-04-04 [?] RSPM (R 4.4.0)
P htmlwidgets 1.6.4 2023-12-06 [?] RSPM
P httpuv 1.6.15 2024-03-26 [?] RSPM (R 4.4.0)
P later 1.3.2 2023-12-06 [?] RSPM (R 4.4.0)
P lifecycle 1.0.4 2023-11-07 [?] RSPM (R 4.4.0)
P magrittr 2.0.3 2022-03-30 [?] RSPM (R 4.4.0)
P memoise 2.0.1 2021-11-26 [?] RSPM (R 4.4.0)
P mime 0.12 2021-09-28 [?] RSPM (R 4.4.0)
P miniUI 0.1.1.1 2018-05-18 [?] RSPM
P pkgbuild 1.4.4 2024-03-17 [?] RSPM
P pkgload 1.4.0 2024-06-28 [?] RSPM
P profvis 0.3.8 2023-05-02 [?] RSPM
P promises 1.3.0 2024-04-05 [?] RSPM (R 4.4.0)
P purrr 1.0.2 2023-08-10 [?] RSPM
P R6 2.5.1 2021-08-19 [?] RSPM (R 4.4.0)
P Rcpp 1.0.13 2024-07-17 [?] RSPM
P remotes 2.5.0 2024-03-17 [?] RSPM
renv 1.0.7 2024-04-11 [1] CRAN (R 4.4.1)
P rlang 1.1.4 2024-06-04 [?] CRAN (R 4.4.1)
P rstudioapi 0.16.0 2024-03-24 [?] RSPM
P sessioninfo 1.2.2 2021-12-06 [?] RSPM
P shiny 1.9.1 2024-08-01 [?] RSPM
P stringi 1.8.4 2024-05-06 [?] RSPM
P stringr 1.5.1 2023-11-14 [?] RSPM
P urlchecker 1.0.1 2021-11-30 [?] RSPM
P usethis 3.0.0 2024-07-29 [?] CRAN (R 4.4.1)
P vctrs 0.6.5 2023-12-01 [?] RSPM (R 4.4.0)
P xtable 1.8-4 2019-04-21 [?] RSPM (R 4.4.0)
P yaml 2.3.10 2024-07-26 [?] CRAN (R 4.4.1)

@LDSamson LDSamson added the bug Something isn't working label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants