I'm opening this after a bug report in the starters previously called pRojects package cc @moldach. In the package we create and set up projects, possibly from RStudio, without opening them. We're encountering an error when trying to do that from RStudio, at the stage where we initialize a git repo, because usethis:::restart_rstudio() fails.
If I run the following lines in RStudio, not from any project
usethis::create_package("coolcool", open = FALSE)
usethis::proj_set(file.path(getwd(), "coolcool"))
usethis::use_git()
I get
> usethis::create_package("coolcool", open = FALSE)
✔ Creating 'coolcool/'
✔ Setting active project to '/home/maelle/coolcool'
✔ Creating 'R/'
✔ Creating 'man/'
✔ Writing 'DESCRIPTION'
Package: coolcool
Title: What the Package Does (One Line, Title Case)
Version: 0.0.0.9000
Authors@R (parsed):
* First Last <first.last@example.com> [aut, cre]
Description: What the package does (one paragraph).
License: What license it uses
Encoding: UTF-8
LazyData: true
✔ Writing 'NAMESPACE'
✔ Writing 'coolcool.Rproj'
✔ Adding '.Rproj.user' to '.gitignore'
✔ Adding '^coolcool\\.Rproj$', '^\\.Rproj\\.user$' to '.Rbuildignore'
✔ Setting active project to '<no active project>'
> usethis::proj_set(file.path(getwd(), "coolcool"))
✔ Setting active project to '/home/maelle/coolcool'
> usethis::use_git()
✔ Initialising Git repo
✔ Adding '.Rhistory', '.RData' to '.gitignore'
There are 5 files uncommited files:
* '.gitignore'
* '.Rbuildignore'
* 'coolcool.Rproj'
* 'DESCRIPTION'
* 'NAMESPACE'
Is it ok to commit them?
1: For sure
2: Not now
3: No way
Selection: 1
✔ Adding files
✔ Commit with message 'Initial commit'
Error in enc2utf8(path) : argument is not a character vector
I've tried running the corresponding usethis internal functions one by one and the exact line causing the error is
usethis:::in_rstudio(usethis::proj_get())
More precisely what fails inside usethis:::in_rstudio is
fs::path_real(proj)
Error in enc2utf8(path) : argument is not a character vector
because proj is NULL.
I'm wondering whether this is something that could be fixed in usethis i.e. making it possible to initialize a git repo in another project, or whether we in starters should rather use git2r functions directly?
I'm opening this after a bug report in the
starterspreviously calledpRojectspackage cc @moldach. In the package we create and set up projects, possibly from RStudio, without opening them. We're encountering an error when trying to do that from RStudio, at the stage where we initialize a git repo, becauseusethis:::restart_rstudio()fails.If I run the following lines in RStudio, not from any project
I get
I've tried running the corresponding
usethisinternal functions one by one and the exact line causing the error isMore precisely what fails inside
usethis:::in_rstudioisbecause
projisNULL.I'm wondering whether this is something that could be fixed in
usethisi.e. making it possible to initialize a git repo in another project, or whether we instartersshould rather usegit2rfunctions directly?