% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sandbox.R
\name{setup_sandbox}
\alias{setup_sandbox}
\title{Setup a Sandbox Environment for Testing}
\usage{
setup_sandbox(files = NULL, temp_base = NULL)
}
\arguments{
\item{files}{Character vector of relative file or directory paths to copy
to the sandbox. Leave as \code{NULL} (default) to create an empty sandbox.
Paths are resolved relative to the project root (found
using \code{find_root()}); if the project root cannot be determined the
current working directory is used.  When a path refers to a directory,
the entire directory is copied recursively.  Absolute paths and path
traversal attempts (e.g., \code{..}) are rejected for security.
Snapshot files do \emph{not} need to be listed here: \code{snapshot()}
always reads snapshots from the project root, not from the sandbox.}

\item{temp_base}{Optional. Custom location for the temporary directory.
If NULL (default), uses \code{tempfile()}.}
}
\value{
A list with class "resultcheck_sandbox" containing:
\item{path}{The path to the created temporary directory}
\item{id}{A unique timestamp-based identifier for this sandbox}
}
\description{
Creates a temporary directory and copies specified files and/or directories
into it while preserving their path structure. This is useful for testing
empirical analysis scripts in isolation.
}
\examples{
with_example({
  sandbox <- setup_sandbox()
  print(sandbox$path)
  cleanup_sandbox(sandbox)
})
}
