You could now simplify this function by terminating early if not rstudio, or windows.