usethis::create_package() needs path, empty path does not create default path

Created on 31 May 2019  ·  2Comments  ·  Source: r-lib/usethis

Related to #92, help file suggests that create_package(), with no path specified, will create a path, but it does not.

This might be the intended behavior, but I was assuming if I was in an empty R project, I could run create_package(), and it would create a package inside the project folder, using the project name. Instead, create_package("../projectName") was needed.

Create an empty R project, then

usethis::create_package() #doesn't create a new package with "default" path
Error in user_path_prep(path) : 
  argument "path" is missing, with no default

Not sure if #92 was closed because the proposed "." was implemented, but if so, that doesn't appear to work either:

usethis::create_package(".")
Error: '.' is not a valid package name. It should:
* Contain only ASCII letters, numbers, and '.'
* Have at least two characters
* Start with a letter
* Not end with '.'
bug paths 🚶‍♂️ wip

Most helpful comment

I look forward to that feature.

Just noticing that https://github.com/r-lib/usethis/pull/916/commits/cfc1e37cb03ef830069280869bedfecf5fcb6f25 seems to fix this issue but the pull request is still pending for review.

@CrumpLab, in the meantime the workaround I've used is this: If have my working directory set to the existing directory "somewhere/abc", I can create a package with usethis::create_package("../abc"). I agree with it's be better to call usethis::create_package(".") because it's consistent with usethis::create_project(".") and with fs's notion of path = ".".

All 2 comments

There's been a lot of path handling work in usethis since #92 unfolded and I suspect that is related to how we lost this behaviour.

I look forward to that feature.

Just noticing that https://github.com/r-lib/usethis/pull/916/commits/cfc1e37cb03ef830069280869bedfecf5fcb6f25 seems to fix this issue but the pull request is still pending for review.

@CrumpLab, in the meantime the workaround I've used is this: If have my working directory set to the existing directory "somewhere/abc", I can create a package with usethis::create_package("../abc"). I agree with it's be better to call usethis::create_package(".") because it's consistent with usethis::create_project(".") and with fs's notion of path = ".".

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chris-billingham picture chris-billingham  ·  5Comments

jennybc picture jennybc  ·  4Comments

aosmith16 picture aosmith16  ·  5Comments

rorynolan picture rorynolan  ·  6Comments

pieterjanvc picture pieterjanvc  ·  5Comments