R/deprecated/define_roots.R

Defines functions define_git_repo_root

#' Find the root directory of a git repository.
#' 
#' Only reliable with Rstudio interactive sessions.
#'
#' @return [path] path to root folder
#'
#' @examples
define_git_repo_root <- function(){
  INTERACTIVE <- rstudioapi::isAvailable()
  
  git_root_criterion <- rprojroot::is_git_root
  
  if(!INTERACTIVE) stop("This is only reliable with Rstudio interactive sessions.")
  
  git_root <- rprojroot::find_root(git_root_criterion)
  
  message("Repo root is ", git_root)
  
  return(git_root)
}
epi-sam/SamsElves documentation built on June 12, 2025, 7 a.m.