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

Don’t fail if ‘rstudioapi’ isn’t installed #293

Closed
klmr opened this issue Sep 1, 2022 · 2 comments
Closed

Don’t fail if ‘rstudioapi’ isn’t installed #293

klmr opened this issue Sep 1, 2022 · 2 comments
Assignees

Comments

@klmr
Copy link
Owner

klmr commented Sep 1, 2022

Currently ‘box’ assumes that ‘rstudioapi’ is installed if the code is run from inside RStudio:

box/R/paths.r

Line 193 in 0345109

document_path = rstudioapi::getActiveDocumentContext()$path

However, this is apparently not always the case. Make code conditional on the package’s existence, or avoid depending on it altogether.

@klmr klmr self-assigned this Sep 1, 2022
@klmr klmr added the ⚠️ bug label Sep 1, 2022
@klmr
Copy link
Owner Author

klmr commented Sep 1, 2022

Could probably be implemented as as.environment("tools:rstudio")$.rs.api.getActiveDocumentContext()$path. Caveat: this uses private (?) RStudio APIs.

@klmr klmr closed this as completed in 461c706 Sep 4, 2022
@klmr
Copy link
Owner Author

klmr commented Sep 5, 2022

See unresolved comment on 461c706.

@klmr klmr reopened this Sep 5, 2022
@klmr klmr closed this as completed Sep 10, 2022
radbasa pushed a commit to Appsilon/box that referenced this issue Jul 1, 2024
Fall back to 'tools:rstudio' inside RStudio where appropriate and
possible. Generate a warning otherwise.

Fixes klmr#293.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant