R/find_dropbox.R

Defines functions find_dropbox

Documented in find_dropbox

#' Find path to Dropbox installation on local machine
#'
#' @return
#' @export
#'
#' @examples
find_dropbox <- function(){
  if (Sys.info()['sysname'] == 'Darwin') {
    info <- RJSONIO::fromJSON(
      file.path(path.expand("~"),'.dropbox','info.json'))
  }
  if (Sys.info()['sysname'] == 'Windows') {
    info <- RJSONIO::fromJSON(
      if (file.exists(file.path(Sys.getenv('APPDATA'), 'Dropbox','info.json'))) {
        file.path(Sys.getenv('APPDATA'), 'Dropbox', 'info.json')
      } else {
        file.path(Sys.getenv('LOCALAPPDATA'),'Dropbox','info.json')
      }
    )
  }
  return(info$personal$path)
}
webbedfeet/ProjTemplate documentation built on May 29, 2019, 10:50 a.m.