% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{.trackFile}
\alias{.trackFile}
\title{Name a file in the served tracks directory, and have it removed with the
session that asked for it}
\usage{
.trackFile(session, ext)
}
\arguments{
\item{session}{a shiny session object}

\item{ext}{character string, the extension of the served file}
}
\value{
string with the path to the file
}
\description{
Loaders write a file per track load and nothing ever removes
it. In an interactive session that is harmless - the default directory sits
under \code{tempdir()} and goes with the process - but a deployed app keeps
one R process across many user sessions, and \code{TRACKS_DIR} may point
outside \code{tempdir()} altogether, where nothing removes the files at all.
Alignment loads make it concrete: a bam export or a cram copy is gigabytes.

The paths handed out to one session are collected in that session's
\code{userData}, and the first call registers a single
\code{session$onSessionEnded()} hook to unlink the set. Assignment goes
through a local binding to the \code{userData} environment on purpose:
\code{session$userData$x <- value} would call the assignment method of a
module's session proxy, which refuses to be written to.
}
\keyword{internal}
