Skip to content

use_course() should open projects in Positron without an .Rproj file #2127

@cwickham

Description

@cwickham

use_course() relies on the presence of an .Rproj file to trigger opening the project via rstudioapi::openProject():

usethis/R/course.R

Lines 398 to 409 in 4aa55e7

if (is_interactive()) {
rproj_path <- rproj_paths(target)
if (length(rproj_path) == 1 && rstudioapi::hasFun("openProject")) {
ui_bullets(c("v" = "Opening project in RStudio."))
rstudioapi::openProject(target, newSession = TRUE)
} else if (!in_rstudio_server()) {
ui_bullets(c(
"v" = "Opening {.path {pth(target, base_path)}} in the file manager."
))
utils::browseURL(path_real(target))
}
}

For a project designed to be used in Positron, this file may not be present, but it would be nice if the project still opened in a new Positron window.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions