rappdirs/0000755000176200001440000000000012676316663012116 5ustar liggesusersrappdirs/tests/0000755000176200001440000000000012366756153013256 5ustar liggesusersrappdirs/tests/testthat/0000755000176200001440000000000012366756153015116 5ustar liggesusersrappdirs/tests/testthat/test-user_cache_dir.r0000644000176200001440000000061212366756153021214 0ustar liggesuserscontext("user_cache_dir") test_that("user_cache_dir works as expected", { if (Sys.getenv("XDG_CACHE_HOME", path.expand("~/.cache")) == path.expand("~/.cache")) { expect_equal(user_cache_dir("R", os="unix"), file_path("~/.cache/R")) } expect_equal(user_cache_dir("R", os="mac"), file_path("~/Library/Caches/R")) expect_warning(user_cache_dir(version = "1.1"), regexp = "appname") }) rappdirs/tests/testthat/test-appdir.r0000644000176200001440000000056312366756153017541 0ustar liggesuserscontext("appdir") test_that("appdir works as expected", { ggplot2_app <- app_dir("ggplot2", "hadley") if (get_os() != "unix") { expect_equal(ggplot2_app$config(), ggplot2_app$data()) } else if (Sys.getenv("XDG_DATA_HOME", ".local/share") != Sys.getenv("XDG_CONFIG_HOME", "config")) { expect_false(identical(ggplot2_app$config(), ggplot2_app$data())) } }) rappdirs/tests/testthat/test-user_config_dir.r0000644000176200001440000000244312366756153021422 0ustar liggesuserscontext("user_config_dir") test_that("user_config_dir works as expected", { if (Sys.getenv("XDG_CONFIG_HOME", path.expand("~/.config")) == path.expand("~/.config")) { expect_equal(user_config_dir("R", os="unix"), file_path("~/.config/R")) } expect_equal(user_config_dir("R", os="mac"), file_path("~/Library/Application Support/R")) expect_equal(user_config_dir("R", version="%V", os="mac", expand=TRUE), file_path("~/Library/Application Support/R", as.character(getRversion()))) expect_equal(user_config_dir("R", version="%V", os="mac", expand=FALSE), file_path("~/Library/Application Support/R/%V")) if (!is.na(Sys.getenv("APPDATA", unset=NA))) { expect_equal(user_config_dir("R", os="win", roaming=TRUE), file_path(Sys.getenv("APPDATA"), "R", "R")) } if (is.na(Sys.getenv("LOCALAPPDATA", unset=NA))) { if (!is.na(Sys.getenv("USERPROFILE", unset=NA))) { expect_equal(user_config_dir("R", os="win", roaming=FALSE), file_path(Sys.getenv("USERPROFILE"), "Local Settings", "Application Data", "R", "R")) } } else { expect_equal(user_config_dir("R", os="win", roaming=FALSE), file_path(Sys.getenv("LOCALAPPDATA"), "R", "R")) } }) rappdirs/tests/testthat/test-site_data_dir.r0000644000176200001440000000157012366756153021054 0ustar liggesuserscontext("site_data_dir") test_that("site_data_dir works as expected", { if (all(c("/usr/local/share", "/usr/share") %in% parse_path_string(Sys.getenv("XDG_DATA_DIRS", "/usr/local/share:/usr/share")))) { expect_equal(all(c("/usr/local/share/R", "/usr/share/R") %in% site_data_dir("R", os="unix", multipath=TRUE)), TRUE) expect_equal(all(c("/usr/local/share/R", "/usr/share/R") %in% site_data_dir("R", os="unix")), FALSE) } expect_equal(site_data_dir("R", os="mac"), file_path("/Library/Application Support/R")) expect_equal(site_data_dir("R", version="%V", os="mac", expand=TRUE), file_path("/Library/Application Support/R", as.character(getRversion()))) expect_equal(site_data_dir("R", version="%V", os="mac", expand=FALSE), file_path("/Library/Application Support/R/%V")) }) rappdirs/tests/testthat/test-site_config_dir.r0000644000176200001440000000054512366756153021411 0ustar liggesuserscontext("site_config_dir") test_that("site_config_dir works as expected", { if (all("/etc/xdg" %in% parse_path_string(Sys.getenv("XDG_CONFIG_DIRS", "/etc/xdg")))) { expect_equal(all("/etc/xdg/R" %in% site_config_dir("R", os="unix", multipath=TRUE)), TRUE) } expect_equal(site_config_dir("R", os="mac"), site_data_dir("R", os="mac")) }) rappdirs/tests/testthat/test-user_log_dir.r0000644000176200001440000000065012366756153020734 0ustar liggesuserscontext("user_log_dir") test_that("user_cache_dir works as expected", { if (Sys.getenv("XDG_CACHE_HOME", path.expand("~/.cache")) == path.expand("~/.cache")) { expect_equal(user_log_dir("R", os="unix"), file_path("~/.cache/R/log")) expect_equal(user_log_dir("R", os="unix", opinion=FALSE), file_path("~/.cache/R")) } expect_equal(user_cache_dir("R", os="mac"), file_path("~/Library/Caches/R")) }) rappdirs/tests/testthat/test-utils.r0000644000176200001440000000132312676275311017411 0ustar liggesuserscontext("utils") test_that("expand_r_libs_specifiers works as expected", { expect_equal(expand_r_libs_specifiers("%V"), as.character(getRversion())) expect_equal(expand_r_libs_specifiers("%%V"), "%V") expect_true(is.null(expand_r_libs_specifiers(NULL))) }) test_that("parse_path_string works as expected", { expect_equal(parse_path_string("/home/foo/bin:/bin:/usr/share/bin:/bin"), file_path_vec(c("/home/foo/bin", "/bin", "/usr/share/bin"))) expect_equal(parse_path_string("/home/foo/bin"), file_path("/home/foo/bin")) }) test_that("file_path_vec works as expected", { expect_equal(file_path_vec("rappdirs", "appname", "version"), file_path("rappdirs", "appname", "version")) }) rappdirs/tests/test-all.R0000644000176200001440000000005212366756153015123 0ustar liggesuserslibrary(testthat) test_check("rappdirs") rappdirs/src/0000755000176200001440000000000012676300057012673 5ustar liggesusersrappdirs/src/win-path.c0000644000176200001440000000126112676300057014566 0ustar liggesusers#include #include #ifdef WIN32 #include // SHGetFolderPath documentation: // http://msdn.microsoft.com/en-us/library/windows/desktop/bb762181.aspx SEXP win_path(SEXP _folder) { int folder = INTEGER(_folder)[0]; TCHAR startupFolder[MAX_PATH]; HRESULT hr = SHGetFolderPath(0, folder, 0, 0, startupFolder); if (SUCCEEDED(hr)) { // Get short path TCHAR shortPath[MAX_PATH]; GetShortPathName(startupFolder, shortPath, MAX_PATH); return mkString(shortPath); } else { // Return NULL if failed return R_NilValue; } } #else SEXP win_path(int folder) { return R_NilValue; } #endif rappdirs/NAMESPACE0000644000176200001440000000035212676275142013331 0ustar liggesusers# Generated by roxygen2: do not edit by hand export(app_dir) export(site_config_dir) export(site_data_dir) export(user_cache_dir) export(user_config_dir) export(user_data_dir) export(user_log_dir) import(methods) useDynLib(rappdirs) rappdirs/NEWS.md0000644000176200001440000000066612676277366013232 0ustar liggesusers## rappdirs 0.3.1 Minor R CMD check and test fixes. ## rappdirs 0.3.0 * first CRAN release * `xxx_dir()` functions only use version when appname is not null * docs: basic package docs (?rappdirs) * docs: clarify primary purpose of os argument in `xxx_dir()` i.e. testing * fix typo in function name in README.md (app_dirs -> app_dir) * dev: add travis continuous integration * dev: add rstudio project * dev: update to roxygen2 v4.0.1 rappdirs/R/0000755000176200001440000000000012366756153012315 5ustar liggesusersrappdirs/R/log.r0000644000176200001440000000351012366756153013260 0ustar liggesusers#' Return full path to the user-specific log dir for this application. #' #' Typical user cache directories are: #' #' \itemize{ #' \item Mac OS X: \file{~/Library/Logs/} #' \item Unix: \file{~/.cache//log}, or under #' \\env{$XDG_CACHE_HOME} if defined #' \item Win XP: \file{C:\\Documents and Settings\\\\Local Settings\\Application Data\\\\\\Logs} #' \item Vista: #' \file{C:\\Users\\\\AppData\\Local\\\\\\Logs} #' } #' #' On Windows the only suggestion in the MSDN docs is that local settings #' go in the \code{CSIDL_LOCAL_APPDATA} directory. (Note: I'm interested in #' examples of what some windows apps use for a logs dir.) #' #' @section Opinion: #' This function appends \file{Logs} to the `CSIDL_LOCAL_APPDATA` #' value for Windows and appends \file{log} to the user cache dir for Unix. #' This can be disabled with the \code{opinion = FALSE} option. #' #' @inheritParams user_data_dir #' @param opinion (logical) can be \code{FALSE} to disable the appending of #' \file{Logs} to the base app data dir for Windows, and \file{log} to the #' base cache dir for Unix. See discussion below. #' @examples #' user_log_dir() #' @export user_log_dir <- function(appname = NULL, appauthor = appname, version = NULL, opinion = TRUE, expand = TRUE, os = get_os()) { if (expand) version <- expand_r_libs_specifiers(version) if (is.null(appname) && !is.null(version)) { version <- NULL warning("version is ignored when appname is null") } switch(os, win = file_path(win_path("local"), appauthor, appname, version, if (opinion) "Logs"), mac = file_path("~/Library/Logs", appname, version), unix = file_path(Sys.getenv("XDG_CACHE_HOME", "~/.cache"), appname, version, if (opinion) "log") ) } rappdirs/R/utils.r0000644000176200001440000000604412366756153013644 0ustar liggesusersget_os <- function() { if (.Platform$OS.type == "windows") { "win" } else if (Sys.info()["sysname"] == "Darwin") { "mac" } else if (.Platform$OS.type == "unix") { "unix" } else { stop("Unknown OS") } } gsub_special <- function(pattern, replacement, x) { gsub(paste0("([^%]|^)", pattern), paste0("\\1", replacement), x) } expand_r_libs_specifiers <- function(version_path) { if (is.null(version_path)) return (NULL) rversion <- getRversion() version_path <- gsub_special("%V", rversion, version_path) version_path <- gsub_special("%v", paste(rversion$major, rversion$minor, sep="."), version_path) version_path <- gsub_special("%p", R.version$platform, version_path) version_path <- gsub_special("%o", R.version$os, version_path) version_path <- gsub_special("%a", R.version$arch, version_path) version_path <- gsub("%%", "%", version_path) version_path } parse_path_string <- function(path, sep=":") { normalizePath(unique(strsplit(path, sep)[[1]]), mustWork=FALSE) } file_path <- function(...) { normalizePath(do.call("file.path", as.list(c(...))), mustWork = FALSE) } # For site_*_dir with multipath = TRUE file_path_vec <- function(paths, ...) { vapply(paths, file_path, FUN.VALUE = character(1), ..., USE.NAMES = FALSE) } "%||%" <- function(a, b) if (is.null(a)) b else a # type_appdata in "roaming", "local", "common" win_path <- function(type_appdata = "common", os = get_os()) { if (os == "win") { switch(type_appdata, roaming = win_path_csidl(CSIDL_APPDATA) %||% win_path_env("roaming"), local = win_path_csidl(CSIDL_LOCAL_APPDATA) %||% win_path_env("local"), common = win_path_csidl(CSIDL_COMMON_APPDATA) %||% win_path_env("common") ) } else { switch(type_appdata, roaming = "C:/Users//AppData", local = "C:/Users//Local", common = "C:/ProgramData" ) } } CSIDL_APPDATA <- 26L CSIDL_COMMON_APPDATA <- 35L CSIDL_LOCAL_APPDATA <- 28L #' @useDynLib rappdirs win_path_csidl <- function(csidl = CSIDL_COMMON_APPDATA) { stopifnot(is.integer(csidl), length(csidl) == 1) path <- .Call("win_path", csidl, PACKAGE = "rappdirs") path } Sys.getenv_force <- function(env) { val <- Sys.getenv(env, unset = NA) if (!is.na(val)) return(val) stop("Could not find Windows environmental variables") } # How to get reasonable window paths via environmental variables win_path_env <- function(type_appdata) { if (type_appdata == "roaming") { Sys.getenv_force("APPDATA") } else if (type_appdata == "local") { path <- Sys.getenv("LOCALAPPDATA", unset=NA) if (is.na(path)) { # environmental variable not defined in XP path <- file.path(Sys.getenv_force("USERPROFILE"), "Local Settings", "Application Data") } path } else if (type_appdata == "common") { path <- Sys.getenv("PROGRAMDATA", unset=NA) if (is.na(path)) { path <- file.path(Sys.getenv_force("ALLUSERPROFILE"), "Application Data") } path } else { stop("invalid `type_appdata` argument") } } rappdirs/R/rappdirs-package.r0000644000176200001440000000440012366756153015713 0ustar liggesusers#' Application directories: determine where to save data, caches and logs. #' #' @description rappdirs solves the problem of where to save persistent data #' outside of the R library or the R per-session \code{\link{tempdir}}. #' #' @section main functions: \itemize{ #' #' \item user data dir (\code{user_data_dir}) #' #' \item user config dir (\code{user_config_dir}) #' #' \item user cache dir (\code{user_cache_dir}) #' #' \item site data dir (\code{site_data_dir}) #' #' \item user log dir (\code{user_log_dir}) #' #' } #' #' @section single entry function: #' #' The \code{app_dir} provides a convenient single entry point. #' #' @section Caveats: Note that if you use rappdir's \code{\link{user_data_dir}} #' and friends to define a storage location for files you must be aware of #' \href{http://en.wikipedia.org/wiki/Race_condition}{race conditions} when #' more than one R process tries to create/write files in this directory. This #' is in contrast to using the \code{\link{tempdir}}, \code{\link{tempfile}} #' base functions which should be unique for each R process. In general the #' directories provided by rappdirs are most suitable for storing data that is #' rarely written but might need to be shared across R sessions. #' #' Note also that the #' \href{http://cran.r-project.org/web/packages/policies.html}{CRAN Policies} #' have the following to say about storage of data by packages: #' #' - Packages should not write in the users' home filespace, nor anywhere else #' on the file system apart from the R session's temporary directory (or #' during installation in the location pointed to by TMPDIR: and such usage #' should be cleaned up). Installing into the system's R installation (e.g., #' scripts to its bin directory) is not allowed. #' #' Limited exceptions may be allowed in interactive sessions if the package #' obtains confirmation from the user. #' #' @examples #' dirs <- app_dir("SuperApp", "Acme") #' dirs$config() #' #' @seealso \code{\link{app_dir}, \link{user_data_dir}, \link{user_config_dir}, #' \link{user_cache_dir}, \link{site_data_dir}, \link{user_log_dir}} #' @docType package #' @name rappdirs-package #' @aliases rappdirs #' @import methods NULL rappdirs/R/cache.r0000644000176200001440000000461212366756153013546 0ustar liggesusers#' Return full path to the user-specific cache dir for this application. #' #' Typical user cache directories are: #' #' \itemize{ #' \item Mac OS X: \file{~/Library/Caches/} #' \item Unix: \file{~/.cache/}, \env{$XDG_CACHE_HOME} if defined #' \item Win XP: \file{C:\\Documents and Settings\\\\Local Settings\\Application Data\\\\\\Cache} #' \item Vista: \file{C:\\Users\\\\AppData\\Local\\\\\\Cache} #' } #' #' On Windows the only suggestion in the MSDN docs is that local settings go #' in the `CSIDL_LOCAL_APPDATA` directory. This is identical to the #' non-roaming app data dir (the default returned by `user_data_dir` above). #' Apps typically put cache data somewhere *under* the given dir here. Some #' examples: \file{...\\Mozilla\\Firefox\\Profiles\\\\Cache}, #' \file{...\\Acme\\SuperApp\\Cache\\1.0} #' #' @section Opinion: #' This function appends \file{Cache} to the `CSIDL_LOCAL_APPDATA` value. #' This can be disabled with \code{opinion = FALSE} option. #' #' @inheritParams user_data_dir #' @param opinion (logical) can be \code{FALSE} to disable the appending of #' \file{Cache} to the base app data dir for Windows. See discussion below. #' @seealso \code{\link{tempdir}} for a non-persistent temporary directory. #' @examples #' user_cache_dir("rappdirs") #' \dontrun{ #' # Throw this in your R profile to store a R history file in standard cache location #' if(capabilities("cledit")) { #' cache_dir <- rappdirs::user_cache_dir("R") #' history_file <- file.path(cache_dir, "Rhistory") #' .First <- function() utils::loadhistory(history_file) #' .Last <- function() { #' if (!file.exists(cache_dir)) dir.create(cache_dir, recursive = TRUE) #' try(savehistory(history_file)) #' } #' } #' } #' @export user_cache_dir <- function(appname = NULL, appauthor = appname, version = NULL, opinion = TRUE, expand = TRUE, os = get_os()) { if (expand) version <- expand_r_libs_specifiers(version) if (is.null(appname) && !is.null(version)) { version <- NULL warning("version is ignored when appname is null") } switch(os, win = file_path(win_path("local"), appauthor, appname, version, if (opinion) "Cache"), mac = file_path("~/Library/Caches", appname, version), unix = file_path(Sys.getenv("XDG_CACHE_HOME", "~/.cache"), appname, version) ) } rappdirs/R/data.r0000644000176200001440000002101212366756153013405 0ustar liggesusers#' Return path to user data directories. #' #' \code{user_data_dir} returns full path to the user-specific data dir for this application. #' \code{user_config_dir} returns full path to the user-specific configuration directory for this application #' which returns the same path as user data directory in Windows and Mac but a different one for Unix. #' #' Typical user data directories are: #' #' \itemize{ #' \item Mac OS X: \file{~/Library/Application Support/} #' \item Unix: \file{~/.local/share/}, in \env{$XDG_DATA_HOME} if defined #' \item Win XP (not roaming): \file{C:\\Documents and Settings\\\\Data\\\\} #' \item Win XP (roaming): \file{C:\\Documents and Settings\\\\Local Settings\\Data\\\\} #' \item Win 7 (not roaming): #' \file{C:\\Users\\\\AppData\\Local\\\\} #' \item Win 7 (roaming): #' \file{C:\\Users\\\\AppData\\Roaming\\\\} #' } #' Unix also specifies a separate location for user configuration data in #' \itemize{ #' \item Unix: \file{~/.config/}, in \env{$XDG_CONFIG_HOME} if defined #' } #' See for example \url{http://ploum.net/184-cleaning-user-preferences-keeping-user-data/} #' or \url{http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html} for more information. #' Arguably plugins such as R packages should go into the user configuration directory and deleting #' this directory should return the application to a default settings. #' #' The \code{os} parameter allows the calculation of directories based on a #' convention other than the current operating system. This feature is designed #' with package testing in mind and is \emph{not} recommended for end users. One #' possible exception is that some users on "mac" might wish to use the "unix" #' XDG convention. #' #' @param appname is the name of application. If NULL, just the system #' directory is returned. #' @param appauthor (only required and used on Windows) is the name of the #' appauthor or distributing body for this application. Typically #' it is the owning company name. This falls back to appname. #' @param version is an optional version path element to append to the #' path. You might want to use this if you want multiple versions #' of your app to be able to run independently. If used, this #' would typically be ".". Only applied when appname #' is not NULL. #' @param roaming (logical, default \code{FALSE}) can be set \code{TRUE} to #' use the Windows roaming appdata directory. That means that for users on #' a Windows network setup for roaming profiles, this user data will be #' sync'd on login. See #' \url{http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx} #' for a discussion of issues. #' @param os Operating system whose conventions are used to construct the #' requested directory. Possible values are "win", "mac", "unix". If NULL #' (the default) then the convention of the current operating system #' (as determined by rappdirs:::get_os) will be used. This argument is #' unlikely to find much use outside package testing (see details section of #' \code{\link{user_data_dir}}). #' @param expand If TRUE (the default) will expand the \code{R_LIBS} specifiers with their equivalents. #' See \code{\link{R_LIBS}} for list of all possibly specifiers. #' #' @examples #' user_data_dir("rappdirs") #' user_config_dir("rappdirs", version="%p-platform/%v") #' user_config_dir("rappdirs", roaming=TRUE, os="win") #' user_config_dir("rappdirs", roaming=FALSE, os="win") #' user_config_dir("rappdirs", os="unix") #' user_config_dir("rappdirs", os="mac") #' \dontrun{ #' # you could try to use functions to store R libraries in a standard user directory #' # by using the following in your .Rprofile file #' # but unfortunately if rappsdir package was stored in standard user directory then #' # it won't be on R's search path any longer, so would need to be installed system-wide... #' require("utils") #' .libPaths(new=rappdirs::user_config_dir("R", version="%p-platform/%v")) #' } #' @export user_data_dir <- function(appname = NULL, appauthor = appname, version = NULL, roaming = FALSE, expand = TRUE, os = get_os()) { if (expand) version <- expand_r_libs_specifiers(version) if (is.null(appname) && !is.null(version)) { version <- NULL warning("version is ignored when appname is null") } switch(os, win = file_path(win_path(ifelse(roaming, "roaming", "local")), appauthor, appname, version), mac = file_path("~/Library/Application Support", appname, version), unix = file_path(Sys.getenv("XDG_DATA_HOME", "~/.local/share"), appname, version) ) } #' @rdname user_data_dir #' @export user_config_dir <- function(appname = NULL, appauthor = appname, version = NULL, roaming = TRUE, expand = TRUE, os = get_os()) { if (expand) version <- expand_r_libs_specifiers(version) if (is.null(appname) && !is.null(version)) { version <- NULL warning("version is ignored when appname is null") } switch(os, win = file_path(win_path(ifelse(roaming, "roaming", "local")), appauthor, appname, version), mac = file_path("~/Library/Application Support", appname, version), unix = file_path(Sys.getenv("XDG_CONFIG_HOME", "~/.config"), appname, version) ) } #' Return full path to the user-shared data dir for this application. #' #' \code{site_data_dir} returns full path to the user-shared data dir for this application. #' \code{site_config_dir} returns full path to the user-specific configuration directory for this application #' which returns the same path as site data directory in Windows and Mac but a different one for Unix. #' Typical user-shared data directories are: #' #' \itemize{ #' \item Mac OS X: \file{/Library/Application Support/} #' \item Unix: \file{/usr/local/share:/usr/share/} #' \item Win XP: \file{C:\\Documents and Settings\\All Users\\Application Data\\\\} #' \item Vista: (Fail! \file{C:\\ProgramData} is a hidden \emph{system} #' directory on Vista.) #' \item Win 7: \file{C:\\ProgramData\\\\}. #' Hidden, but writeable on Win 7. #' } #' Unix also specifies a separate location for user-shared configuration data in \env{$XDG_CONFIG_DIRS}. #' \itemize{ #' \item Unix: \file{/etc/xdg/}, in \env{$XDG_CONFIG_HOME} if defined #' } #' #' For Unix, this returns the first default. Set the \code{multipath=TRUE} to guarantee returning all directories. #' #' @inheritParams user_data_dir #' @param multipath is an optional parameter only applicable to *nix #' which indicates that the entire list of data dirs should be returned #' By default, the first directory is returned #' @section Warning: #' Do not use this on Windows. See the note above for why. #' @export site_data_dir <- function(appname = NULL, appauthor = appname, version = NULL, multipath = FALSE, expand = TRUE, os = get_os()) { if (expand) version <- expand_r_libs_specifiers(version) if (is.null(appname) && !is.null(version)) { version <- NULL warning("version is ignored when appname is null") } switch(os, win = file_path(win_path("common"), appauthor, appname, version), mac = file_path("/Library/Application Support", appname, version), unix = file_path_site_unix(Sys.getenv("XDG_DATA_DIRS", "/usr/local/share:/usr/share"), appname, version, multipath) ) } #' @rdname site_data_dir #' @export site_config_dir <- function(appname = NULL, appauthor = appname, version = NULL, multipath = FALSE, expand = TRUE, os = get_os()) { if (expand) version <- expand_r_libs_specifiers(version) if (is.null(appname) && !is.null(version)) { version <- NULL warning("version is ignored when appname is null") } switch(os, win = file_path(win_path("common"), appauthor, appname, version), mac = file_path("/Library/Application Support", appname, version), unix = file_path_site_unix(Sys.getenv("XDG_CONFIG_DIRS", "/etc/xdg"), appname, version, multipath) ) } # wrapper with `multipath` and use `parse_path_string` for cleaner switch statement file_path_site_unix <- function(sys_getenv, appname, version, multipath = FALSE) { paths <- parse_path_string(sys_getenv) if (multipath) { file_path_vec(paths, appname, version) } else { file_path(paths[1], appname, version) } } rappdirs/R/appdir.r0000644000176200001440000000272512366756153013765 0ustar liggesusers#' Convenience wrapper for getting app dirs. #' #' Has methods: #' #' \itemize{ #' \item \code{cache} #' \item \code{log} #' \item \code{data} #' \item \code{config} #' \item \code{site_data} #' \item \code{site_config} #' } #' #' @inheritParams user_data_dir #' @export #' @examples #' ggplot2_app <- app_dir("ggplot2", "hadley") #' ggplot2_app$cache() #' ggplot2_app$log() #' ggplot2_app$data() #' ggplot2_app$config() #' ggplot2_app$site_config() #' ggplot2_app$site_data() app_dir <- function(appname = NULL, appauthor = appname, version = NULL, expand = TRUE, os = get_os()) { appdirs$new(appname = appname, appauthor = appauthor, version = version, expand = expand, os = os) } appdirs <- setRefClass("AppDirs", fields = c("appname", "appauthor", "version", "expand", "os" ), methods = list( cache = function(opinion = TRUE) user_cache_dir(appname, appauthor, version, opinion, expand, os), log = function(opinion = TRUE) user_log_dir(appname, appauthor, version, opinion, expand, os), data = function(roaming = FALSE) { user_data_dir(appname, appauthor, version, roaming, expand, os) }, config = function(roaming = FALSE) { user_config_dir(appname, appauthor, version, roaming, expand, os) }, site_data = function(multipath = FALSE) site_data_dir(appname, appauthor, version, multipath, expand, os), site_config = function(multipath = FALSE) site_config_dir(appname, appauthor, version, multipath, expand, os) ) ) rappdirs/README.md0000644000176200001440000001034412366756153013375 0ustar liggesusers[![Build Status](https://travis-ci.org/hadley/rappdirs.svg)](https://travis-ci.org/hadley/rappdirs) `rappdirs` is a port of [appdirs](https://github.com/ActiveState/appdirs) to R. The problem =========== What directory should your app use for storing user data? If running on Mac OS X, you should use: ~/Library/Application Support/ If on Windows (at least English Win XP) that should be: C:\Documents and Settings\\Application Data\Local Settings\\ or possibly: C:\Documents and Settings\\Application Data\\ for [roaming profiles][] but that is another story. On Linux (and other Unices) the dir, according to the [XDG spec][] (and subject to some interpretation), is either: ~/.config/ or possibly: ~/.local/share/ `rappdirs` to the rescue ======================= This kind of thing is what the `appdirs` module is for. `appdirs` will help you choose an appropriate: - user data dir (`user_data_dir`) - user config dir (`user_config_dir`) - user cache dir (`user_cache_dir`) - site data dir (`site_data_dir`) - user log dir (`user_log_dir`) and also: - is slightly opinionated on the directory names used. Look for 'Opinion' in documentation and code for when an opinion is being applied. some example output =================== On Mac OS X: library(appdirs) appname <- "SuperApp" appauthor <- "Acme" user_config_dir(appname, appauthor) # "/Users/trentm/Library/Application Support/SuperApp" user_data_dir(appname, appauthor) # "/Users/trentm/Library/Application Support/SuperApp" site_data_dir(appname, appauthor) # "/Library/Application Support/SuperApp" user_cache_dir(appname, appauthor) "/Users/trentm/Library/Caches/SuperApp" user_log_dir(appname, appauthor) "/Users/trentm/Library/Logs/SuperApp" On Windows 7: library(appdirs) appname <- "SuperApp" appauthor <- "Acme" user_config_dir(appname, appauthor) # "C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp" user_data_dir(appname, appauthor) # "C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp" user_data_dir(appname, appauthor, roaming=True) # "C:\\Users\\trentm\\AppData\\Roaming\\Acme\\SuperApp" user_cache_dir(appname, appauthor) # "C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp\\Cache" user_log_dir(appname, appauthor) # "C:\\Users\\trentm\\AppData\\Local\\Acme\\SuperApp\\Logs" On Linux: library(appdirs) appname <- "SuperApp" appauthor <- "Acme" user_config_dir(appname, appauthor) # "/home/trentm/.config/SuperApp user_data_dir(appname, appauthor) # "/home/trentm/.local/share/SuperApp site_config_dir(appname, appauthor) # "/etc/xdg/SuperApp" user_cache_dir(appname, appauthor) # "/home/trentm/.cache/SuperApp" user_log_dir(appname, appauthor) # "/home/trentm/.cache/SuperApp/log" `app_dir` for convenience ========================= library(appdirs) dirs <- app_dir("SuperApp", "Acme") dirs$config() # "/Users/trentm/Library/Application Support/SuperApp" dirs$data() # "/Users/trentm/Library/Application Support/SuperApp" dirs$site_data() # "/Library/Application Support/SuperApp" dirs$cache() # "/Users/trentm/Library/Caches/SuperApp" dirs$log() # "/Users/trentm/Library/Logs/SuperApp" Per-version isolation ===================== If you have multiple versions of your app in use that you want to be able to run side-by-side, then you may want version-isolation for these dirs: library(appdirs) dirs <- app_dir("SuperApp", "Acme", version = "1.0") dirs$data() # "/Users/trentm/Library/Application Support/SuperApp/1.0" dirs$site_data() # "/Library/Application Support/SuperApp/1.0" dirs$cache() # "/Users/trentm/Library/Caches/SuperApp/1.0" dirs$log() # "/Users/trentm/Library/Logs/SuperApp/1.0" If you set the argument expand = TRUE (the default) you can have directories that correspond to R versions: user_config_dir("R", version="%p-platform/%v") # "/home/trevorld/.config/R/x86_64-pc-linux-gnu-platform/3.0" [roaming profiles]: http://bit.ly/9yl3b6 [XDG spec]: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html rappdirs/MD50000644000176200001440000000256512676316663012436 0ustar liggesusers4e508d79ea88045eb10482811c6263f3 *DESCRIPTION d913e1265e23e90746f1d93e3a5e8d42 *LICENSE c5a5dadf2e060e06f0d60950f33a2482 *NAMESPACE b5f9cef075f7f3f2279a0aed7af6b6bc *NEWS.md fde4c5a72ac6e90f27c16537238fd4e4 *R/appdir.r 42ce1513500dc993a7f63d9014a96fcb *R/cache.r 43016caa70c3d48b9ebcaa20875202f0 *R/data.r f519158dcd546473fb5f207ca43e3fc0 *R/log.r 2483dd5cd8d1494a62af4c25c96bd698 *R/rappdirs-package.r b4b75efd4fb5a831bcf5f7175d14fb47 *R/utils.r 7ec1cf8c8384e3e7105b78ecfe10d630 *README.md 19e8b05fdd6fabe0236f3bc7482bf7f2 *man/app_dir.Rd 348a470834014236851cd94764593109 *man/rappdirs-package.Rd b523d40775c84631ab36d2f624c0d22e *man/site_data_dir.Rd 5c253da2b6e7ab780e7106617b05b953 *man/user_cache_dir.Rd 05e34f3c28f05b23a5893b19cf46ac52 *man/user_data_dir.Rd 69824789121030d47a0ac2a53f5fbbd7 *man/user_log_dir.Rd acf7058779ef3ce022f2e7196a5c0353 *src/win-path.c cb46c47ab53adb22d6ce45ef2e23907f *tests/test-all.R 732e1c19c368e740e183171ec1c76881 *tests/testthat/test-appdir.r 6f1d58c9ec13dbb0de38972b03d2db21 *tests/testthat/test-site_config_dir.r 2dcd6340863bb8420ec8fab8558ac05a *tests/testthat/test-site_data_dir.r ccbf0c1a16ef677ae0cb38b4c882f736 *tests/testthat/test-user_cache_dir.r 8ef0c2839661031dc50e4d92e720ad53 *tests/testthat/test-user_config_dir.r 525b87eaf41d555e81b62758d586620c *tests/testthat/test-user_log_dir.r 26553b6c01a583e37798b7a285ba83ed *tests/testthat/test-utils.r rappdirs/DESCRIPTION0000644000176200001440000000340712676316663013630 0ustar liggesusersPackage: rappdirs Type: Package Title: Application Directories: Determine Where to Save Data, Caches, and Logs Version: 0.3.1 Authors@R: c( person("Hadley", "Wickham", email = "hadley@rstudio.com", role = c("trl", "cre", "cph")), person("RStudio", role = "cph"), person("Sridhar", "Ratnakumar", role = "aut"), person("Trent", "Mick", role = "aut"), person("ActiveState", role = "cph", comment = "R/appdir.r, R/cache.r, R/data.r, R/log.r translated from appdirs"), person("Eddy", "Petrisor", role = "ctb"), person("Trevor", "Davis", role = c("trl", "aut")), person("Gabor", "Csardi", role = "ctb"), person("Gregory", "Jefferis", role = "ctb") ) Depends: R (>= 2.14), methods Suggests: testthat, roxygen2 Description: An easy way to determine which directories on the users computer you should use to save data, caches and logs. A port of Python's 'Appdirs' (\url{https://github.com/ActiveState/appdirs}) to R. BugReports: https://github.com/hadley/rappdirs/issues URL: https://github.com/hadley/rappdirs https://github.com/ActiveState/appdirs License: MIT + file LICENSE Copyright: Original python appdirs module copyright (c) 2010 ActiveState Software Inc. R port copyright Hadley Wickham, RStudio. See file LICENSE for details. RoxygenNote: 5.0.1 NeedsCompilation: yes Packaged: 2016-03-28 19:04:15 UTC; hadley Author: Hadley Wickham [trl, cre, cph], RStudio [cph], Sridhar Ratnakumar [aut], Trent Mick [aut], ActiveState [cph] (R/appdir.r, R/cache.r, R/data.r, R/log.r translated from appdirs), Eddy Petrisor [ctb], Trevor Davis [trl, aut], Gabor Csardi [ctb], Gregory Jefferis [ctb] Maintainer: Hadley Wickham Repository: CRAN Date/Publication: 2016-03-28 23:10:10 rappdirs/man/0000755000176200001440000000000012377145135012661 5ustar liggesusersrappdirs/man/user_log_dir.Rd0000644000176200001440000000474012676275142015636 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/log.r \name{user_log_dir} \alias{user_log_dir} \title{Return full path to the user-specific log dir for this application.} \usage{ user_log_dir(appname = NULL, appauthor = appname, version = NULL, opinion = TRUE, expand = TRUE, os = get_os()) } \arguments{ \item{appname}{is the name of application. If NULL, just the system directory is returned.} \item{appauthor}{(only required and used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname.} \item{version}{is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is not NULL.} \item{opinion}{(logical) can be \code{FALSE} to disable the appending of \file{Logs} to the base app data dir for Windows, and \file{log} to the base cache dir for Unix. See discussion below.} \item{expand}{If TRUE (the default) will expand the \code{R_LIBS} specifiers with their equivalents. See \code{\link{R_LIBS}} for list of all possibly specifiers.} \item{os}{Operating system whose conventions are used to construct the requested directory. Possible values are "win", "mac", "unix". If NULL (the default) then the convention of the current operating system (as determined by rappdirs:::get_os) will be used. This argument is unlikely to find much use outside package testing (see details section of \code{\link{user_data_dir}}).} } \description{ Typical user cache directories are: } \details{ \itemize{ \item Mac OS X: \file{~/Library/Logs/} \item Unix: \file{~/.cache//log}, or under \\env{$XDG_CACHE_HOME} if defined \item Win XP: \file{C:\\Documents and Settings\\\\Local Settings\\Application Data\\\\\\Logs} \item Vista: \file{C:\\Users\\\\AppData\\Local\\\\\\Logs} } On Windows the only suggestion in the MSDN docs is that local settings go in the \code{CSIDL_LOCAL_APPDATA} directory. (Note: I'm interested in examples of what some windows apps use for a logs dir.) } \section{Opinion}{ This function appends \file{Logs} to the `CSIDL_LOCAL_APPDATA` value for Windows and appends \file{log} to the user cache dir for Unix. This can be disabled with the \code{opinion = FALSE} option. } \examples{ user_log_dir() } rappdirs/man/user_data_dir.Rd0000644000176200001440000001043412676275142015763 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/data.r \name{user_data_dir} \alias{user_config_dir} \alias{user_data_dir} \title{Return path to user data directories.} \usage{ user_data_dir(appname = NULL, appauthor = appname, version = NULL, roaming = FALSE, expand = TRUE, os = get_os()) user_config_dir(appname = NULL, appauthor = appname, version = NULL, roaming = TRUE, expand = TRUE, os = get_os()) } \arguments{ \item{appname}{is the name of application. If NULL, just the system directory is returned.} \item{appauthor}{(only required and used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname.} \item{version}{is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is not NULL.} \item{roaming}{(logical, default \code{FALSE}) can be set \code{TRUE} to use the Windows roaming appdata directory. That means that for users on a Windows network setup for roaming profiles, this user data will be sync'd on login. See \url{http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx} for a discussion of issues.} \item{expand}{If TRUE (the default) will expand the \code{R_LIBS} specifiers with their equivalents. See \code{\link{R_LIBS}} for list of all possibly specifiers.} \item{os}{Operating system whose conventions are used to construct the requested directory. Possible values are "win", "mac", "unix". If NULL (the default) then the convention of the current operating system (as determined by rappdirs:::get_os) will be used. This argument is unlikely to find much use outside package testing (see details section of \code{\link{user_data_dir}}).} } \description{ \code{user_data_dir} returns full path to the user-specific data dir for this application. \code{user_config_dir} returns full path to the user-specific configuration directory for this application which returns the same path as user data directory in Windows and Mac but a different one for Unix. } \details{ Typical user data directories are: \itemize{ \item Mac OS X: \file{~/Library/Application Support/} \item Unix: \file{~/.local/share/}, in \env{$XDG_DATA_HOME} if defined \item Win XP (not roaming): \file{C:\\Documents and Settings\\\\Data\\\\} \item Win XP (roaming): \file{C:\\Documents and Settings\\\\Local Settings\\Data\\\\} \item Win 7 (not roaming): \file{C:\\Users\\\\AppData\\Local\\\\} \item Win 7 (roaming): \file{C:\\Users\\\\AppData\\Roaming\\\\} } Unix also specifies a separate location for user configuration data in \itemize{ \item Unix: \file{~/.config/}, in \env{$XDG_CONFIG_HOME} if defined } See for example \url{http://ploum.net/184-cleaning-user-preferences-keeping-user-data/} or \url{http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html} for more information. Arguably plugins such as R packages should go into the user configuration directory and deleting this directory should return the application to a default settings. The \code{os} parameter allows the calculation of directories based on a convention other than the current operating system. This feature is designed with package testing in mind and is \emph{not} recommended for end users. One possible exception is that some users on "mac" might wish to use the "unix" XDG convention. } \examples{ user_data_dir("rappdirs") user_config_dir("rappdirs", version="\%p-platform/\%v") user_config_dir("rappdirs", roaming=TRUE, os="win") user_config_dir("rappdirs", roaming=FALSE, os="win") user_config_dir("rappdirs", os="unix") user_config_dir("rappdirs", os="mac") \dontrun{ # you could try to use functions to store R libraries in a standard user directory # by using the following in your .Rprofile file # but unfortunately if rappsdir package was stored in standard user directory then # it won't be on R's search path any longer, so would need to be installed system-wide... require("utils") .libPaths(new=rappdirs::user_config_dir("R", version="\%p-platform/\%v")) } } rappdirs/man/rappdirs-package.Rd0000644000176200001440000000432412676275142016374 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/rappdirs-package.r \docType{package} \name{rappdirs-package} \alias{rappdirs} \alias{rappdirs-package} \title{Application directories: determine where to save data, caches and logs.} \description{ rappdirs solves the problem of where to save persistent data outside of the R library or the R per-session \code{\link{tempdir}}. } \section{main functions}{ \itemize{ \item user data dir (\code{user_data_dir}) \item user config dir (\code{user_config_dir}) \item user cache dir (\code{user_cache_dir}) \item site data dir (\code{site_data_dir}) \item user log dir (\code{user_log_dir}) } } \section{single entry function}{ The \code{app_dir} provides a convenient single entry point. } \section{Caveats}{ Note that if you use rappdir's \code{\link{user_data_dir}} and friends to define a storage location for files you must be aware of \href{http://en.wikipedia.org/wiki/Race_condition}{race conditions} when more than one R process tries to create/write files in this directory. This is in contrast to using the \code{\link{tempdir}}, \code{\link{tempfile}} base functions which should be unique for each R process. In general the directories provided by rappdirs are most suitable for storing data that is rarely written but might need to be shared across R sessions. Note also that the \href{http://cran.r-project.org/web/packages/policies.html}{CRAN Policies} have the following to say about storage of data by packages: - Packages should not write in the users' home filespace, nor anywhere else on the file system apart from the R session's temporary directory (or during installation in the location pointed to by TMPDIR: and such usage should be cleaned up). Installing into the system's R installation (e.g., scripts to its bin directory) is not allowed. Limited exceptions may be allowed in interactive sessions if the package obtains confirmation from the user. } \examples{ dirs <- app_dir("SuperApp", "Acme") dirs$config() } \seealso{ \code{\link{app_dir}, \link{user_data_dir}, \link{user_config_dir}, \link{user_cache_dir}, \link{site_data_dir}, \link{user_log_dir}} } rappdirs/man/user_cache_dir.Rd0000644000176200001440000000604012676275142016113 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/cache.r \name{user_cache_dir} \alias{user_cache_dir} \title{Return full path to the user-specific cache dir for this application.} \usage{ user_cache_dir(appname = NULL, appauthor = appname, version = NULL, opinion = TRUE, expand = TRUE, os = get_os()) } \arguments{ \item{appname}{is the name of application. If NULL, just the system directory is returned.} \item{appauthor}{(only required and used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname.} \item{version}{is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is not NULL.} \item{opinion}{(logical) can be \code{FALSE} to disable the appending of \file{Cache} to the base app data dir for Windows. See discussion below.} \item{expand}{If TRUE (the default) will expand the \code{R_LIBS} specifiers with their equivalents. See \code{\link{R_LIBS}} for list of all possibly specifiers.} \item{os}{Operating system whose conventions are used to construct the requested directory. Possible values are "win", "mac", "unix". If NULL (the default) then the convention of the current operating system (as determined by rappdirs:::get_os) will be used. This argument is unlikely to find much use outside package testing (see details section of \code{\link{user_data_dir}}).} } \description{ Typical user cache directories are: } \details{ \itemize{ \item Mac OS X: \file{~/Library/Caches/} \item Unix: \file{~/.cache/}, \env{$XDG_CACHE_HOME} if defined \item Win XP: \file{C:\\Documents and Settings\\\\Local Settings\\Application Data\\\\\\Cache} \item Vista: \file{C:\\Users\\\\AppData\\Local\\\\\\Cache} } On Windows the only suggestion in the MSDN docs is that local settings go in the `CSIDL_LOCAL_APPDATA` directory. This is identical to the non-roaming app data dir (the default returned by `user_data_dir` above). Apps typically put cache data somewhere *under* the given dir here. Some examples: \file{...\\Mozilla\\Firefox\\Profiles\\\\Cache}, \file{...\\Acme\\SuperApp\\Cache\\1.0} } \section{Opinion}{ This function appends \file{Cache} to the `CSIDL_LOCAL_APPDATA` value. This can be disabled with \code{opinion = FALSE} option. } \examples{ user_cache_dir("rappdirs") \dontrun{ # Throw this in your R profile to store a R history file in standard cache location if(capabilities("cledit")) { cache_dir <- rappdirs::user_cache_dir("R") history_file <- file.path(cache_dir, "Rhistory") .First <- function() utils::loadhistory(history_file) .Last <- function() { if (!file.exists(cache_dir)) dir.create(cache_dir, recursive = TRUE) try(savehistory(history_file)) } } } } \seealso{ \code{\link{tempdir}} for a non-persistent temporary directory. } rappdirs/man/app_dir.Rd0000644000176200001440000000334212676275142014574 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/appdir.r \name{app_dir} \alias{app_dir} \title{Convenience wrapper for getting app dirs.} \usage{ app_dir(appname = NULL, appauthor = appname, version = NULL, expand = TRUE, os = get_os()) } \arguments{ \item{appname}{is the name of application. If NULL, just the system directory is returned.} \item{appauthor}{(only required and used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname.} \item{version}{is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is not NULL.} \item{expand}{If TRUE (the default) will expand the \code{R_LIBS} specifiers with their equivalents. See \code{\link{R_LIBS}} for list of all possibly specifiers.} \item{os}{Operating system whose conventions are used to construct the requested directory. Possible values are "win", "mac", "unix". If NULL (the default) then the convention of the current operating system (as determined by rappdirs:::get_os) will be used. This argument is unlikely to find much use outside package testing (see details section of \code{\link{user_data_dir}}).} } \description{ Has methods: } \details{ \itemize{ \item \code{cache} \item \code{log} \item \code{data} \item \code{config} \item \code{site_data} \item \code{site_config} } } \examples{ ggplot2_app <- app_dir("ggplot2", "hadley") ggplot2_app$cache() ggplot2_app$log() ggplot2_app$data() ggplot2_app$config() ggplot2_app$site_config() ggplot2_app$site_data() } rappdirs/man/site_data_dir.Rd0000644000176200001440000000562512676275142015757 0ustar liggesusers% Generated by roxygen2: do not edit by hand % Please edit documentation in R/data.r \name{site_data_dir} \alias{site_config_dir} \alias{site_data_dir} \title{Return full path to the user-shared data dir for this application.} \usage{ site_data_dir(appname = NULL, appauthor = appname, version = NULL, multipath = FALSE, expand = TRUE, os = get_os()) site_config_dir(appname = NULL, appauthor = appname, version = NULL, multipath = FALSE, expand = TRUE, os = get_os()) } \arguments{ \item{appname}{is the name of application. If NULL, just the system directory is returned.} \item{appauthor}{(only required and used on Windows) is the name of the appauthor or distributing body for this application. Typically it is the owning company name. This falls back to appname.} \item{version}{is an optional version path element to append to the path. You might want to use this if you want multiple versions of your app to be able to run independently. If used, this would typically be ".". Only applied when appname is not NULL.} \item{multipath}{is an optional parameter only applicable to *nix which indicates that the entire list of data dirs should be returned By default, the first directory is returned} \item{expand}{If TRUE (the default) will expand the \code{R_LIBS} specifiers with their equivalents. See \code{\link{R_LIBS}} for list of all possibly specifiers.} \item{os}{Operating system whose conventions are used to construct the requested directory. Possible values are "win", "mac", "unix". If NULL (the default) then the convention of the current operating system (as determined by rappdirs:::get_os) will be used. This argument is unlikely to find much use outside package testing (see details section of \code{\link{user_data_dir}}).} } \description{ \code{site_data_dir} returns full path to the user-shared data dir for this application. \code{site_config_dir} returns full path to the user-specific configuration directory for this application which returns the same path as site data directory in Windows and Mac but a different one for Unix. Typical user-shared data directories are: } \details{ \itemize{ \item Mac OS X: \file{/Library/Application Support/} \item Unix: \file{/usr/local/share:/usr/share/} \item Win XP: \file{C:\\Documents and Settings\\All Users\\Application Data\\\\} \item Vista: (Fail! \file{C:\\ProgramData} is a hidden \emph{system} directory on Vista.) \item Win 7: \file{C:\\ProgramData\\\\}. Hidden, but writeable on Win 7. } Unix also specifies a separate location for user-shared configuration data in \env{$XDG_CONFIG_DIRS}. \itemize{ \item Unix: \file{/etc/xdg/}, in \env{$XDG_CONFIG_HOME} if defined } For Unix, this returns the first default. Set the \code{multipath=TRUE} to guarantee returning all directories. } \section{Warning}{ Do not use this on Windows. See the note above for why. } rappdirs/LICENSE0000644000176200001440000000013212676277257013124 0ustar liggesusersYEAR: 2001, 2014-2016 COPYRIGHT HOLDER: Hadley Wickham; RStudio; ActiveState Software Inc