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

create_from_github() seems to be permanently changing the working directory #1900

Closed
DavisVaughan opened this issue Oct 11, 2023 · 3 comments

Comments

@DavisVaughan
Copy link
Member

In R, but not in RStudio, run something like this (you will have to tweak it for your directory)

usethis::create_from_github("r-lib/crayon", destdir = "~/files/r/packages/", fork = TRUE)

This should not launch a new RStudio session. It should keep you in the current R session.

However, if you then run getwd() it looks like it has left us permanently moved to the new crayon folder

> getwd()
[1] "/Users/davis/files/r/packages/crayon"

which is not desirable

@jennybc
Copy link
Member

jennybc commented Oct 11, 2023

I think you're describing the intended behaviour outside of RStudio. The assumption is that you are creating a new project from GitHub AND that you want to now work on / in it.

I think to get the result you seemed to want, you should also specify open = FALSE.

@DavisVaughan
Copy link
Member Author

Yea open = FALSE indeed keeps me in the same working directory

@jennybc
Copy link
Member

jennybc commented Oct 12, 2023

So I think create_from_github() is working as designed and you just got somewhat surprised by the difference in behaviour inside RStudio (presumably what you experience more often) vs outside.

@jennybc jennybc closed this as completed Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants