setPaths: Get and set default working directories

View source: R/misc-methods.R

setPathsR Documentation

Get and set default working directories

Description

Wrapper functions to access the packages options for default working directories. Note: there is an active binding made to Paths, so a user can use Paths$cachePath for example instead of getPaths()$cachePath

Usage

.paths()

getPaths()

Paths

setPaths(
  cachePath,
  inputPath,
  modulePath,
  outputPath,
  rasterPath,
  scratchPath,
  terraPath,
  silent = FALSE
)

Arguments

cachePath

The default local directory in which to cache simulation outputs. If not specified, defaults to getOption("reproducible.cachePath").

inputPath

The default local directory in which to look for simulation inputs If not specified, defaults to getOption("spades.inputPath").

modulePath

The default local directory where modules and data will be downloaded and stored. If not specified, defaults to getOption("spades.modulePath").

outputPath

The default local directory in which to save simulation outputs. If not specified, defaults to getOption("spades.outputPath").

rasterPath

The default local directory in which to save transient raster files. If not specified, defaults to file.path(getOption("spades.scratchPath"), "raster"). Important note: this location may not be cleaned up automatically, so be sure to monitor this directory and remove unnecessary temp files that may contribute to excessive disk usage. This option will be deprecated in a future release.

scratchPath

The default local directory in which to save transient files. If not specified, defaults to getOption("spades.scratchPath"). Important note: this location may not be cleaned up automatically, so be sure to monitor this directory and remove unnecessary temp files that may contribute to excessive disk usage.

terraPath

The default local directory in which to save transient terra files. If not specified, defaults to file.path(getOption("spades.scratchPath"), "terra"). Important note: this location may not be cleaned up automatically, so be sure to monitor this directory and remove unnecessary temp files that may contribute to excessive disk usage.

silent

Logical. Should the messaging occur.

Format

An object of class list of length 7.

Value

getPaths returns a named list of the user's default working directories. setPaths is invoked for the side effect of setting these directories.

Author(s)

Alex Chubaty

Examples


getPaths()                       ## returns the current default working paths

## set individual custom paths
setPaths(cachePath = file.path(tempdir(), "cache"))
setPaths(inputPath = file.path(tempdir(), "inputs"))
setPaths(modulePath = file.path(tempdir(), "modules"))
setPaths(outputPath = file.path(tempdir(), "outputs"))
setPaths(scratchPath = file.path(tempdir(), "scratch"))

# NOTE: on loading and attaching SpaDES.core,
# an active binding is made to "Paths"

getPaths()
Paths ## same as getPaths() above
setPaths(outputPath = tempdir())
Paths # shows change



PredictiveEcology/SpaDES.core documentation built on April 17, 2024, 8:27 a.m.