open_sublime_text <- function() {
active_path <- rstudioapi::getActiveDocumentContext()$path
if (is.null(active_path) || !nzchar(active_path)) {
active_path <- rstudioapi::getActiveProject()
}
system2("subl", shQuote(active_path))
}
open_finder <- function() {
active_path <- rstudioapi::getActiveDocumentContext()$path
if (is.null(active_path) || !nzchar(active_path)) {
dir <- rstudioapi::getActiveProject()
} else {
dir <- dirname(active_path)
}
system2("open", shQuote(dir))
}
open_iterm <- function() {
active_path <- rstudioapi::getActiveDocumentContext()$path
if (is.null(active_path) || !nzchar(active_path)) {
dir <- rstudioapi::getActiveProject()
} else {
dir <- dirname(active_path)
}
system2("open", shQuote(c("-a", "iTerm", dir)))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.