bcgov/bcgovr

warning when providing custom directory structure

Closed this issue · 0 comments

I wanted to setup my own directory structure, specifically for shiny apps, and I get a warning about the length of nzchar(dir_struct)

dirs <-  c("app/", "app/app.R")

bcgovr::create_bcgov_project(path = "C:/testproject",
                             coc_email = "email@gov.bc.ca",
                             dir_struct = dirs)
#> <U+2605> Setting up the testproject project
#> v Setting active project to 'C:/testproject'
#> v Creating 'R/'
#> v Writing a sentinel file '.here'
#> * Build robust paths within your project via `here::here()`
#> * Learn more at <https://here.r-lib.org>
#> v Setting active project to '<no active project>'
#> v Setting active project to 'C:/testproject'
#> v Writing 'README.Rmd'
#> v Writing 'CONTRIBUTING.md'
#> v Writing 'CODE_OF_CONDUCT.md'
#> v Writing 'LICENSE'
#> v Writing '.gitattributes'
#> Warning in if (!nzchar(dir_struct)) dir_struct <- character(0): the condition
#> has length > 1 and only the first element will be used
#> <U+2714> Creating new project
#> <U+2714> Populating with directory structure
#> <U+2714> Adding Apache boilerplate header to the top of 'C:\\testproject/app/app.R'
#> <U+2605> Your new project is created in C:/testproject

The issue is that nzchar does not return a single value:

dirs <-  c("app/", "app/app.R")
nzchar(dirs)
#> [1] TRUE TRUE