\Header{.Platform}{Platform Specific Variables}
\keyword{file}{.Platform}
\keyword{utilities}{.Platform}
\begin{Description}\relax
\code{.Platform} is a list with some details of the platform under
which \R{} was built.  This provides means to write OS portable \R{}
code.
\end{Description}
\begin{Usage}
\begin{verbatim}
.Platform
\end{verbatim}
\end{Usage}
\begin{Value}
A list with at least the following components:

\begin{ldescription}
\item[\code{OS.type}] character, giving the \bold{O}perating \bold{S}ystem
(family) of the computer.  One of \code{"unix"} or \code{"windows"}.

\item[\code{file.sep}] character, giving the \bold{file} \bold{sep}arator,
used on your platform, e.g., \code{"/"} on Unix alikes.

\item[\code{dynlib.ext}] character, giving the file name \bold{ext}ension of
\bold{dyn}amically loadable \bold{lib}raries, e.g., \code{".dll"} on
Windows.

\item[\code{GUI}] character, giving the type of GUI in use, or
\code{"unknown"} if no GUI can be assumed.

\item[\code{endian}] character, \code{"big"} or \code{"little"}, giving the
endianness of the processor in use.

\end{ldescription}
\end{Value}
\begin{SeeAlso}\relax
\code{\Link{R.version}} and \code{\Link{Sys.info}} give more details
about the OS.  In particular, \code{R.version\$platform} is the
canonical name of the platform under which \R{} was compiled.

\code{\Link{.Machine}} for details of the arithmetic used, and
\code{\Link{system}} for invoking platform-specific system commands.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
## Note: this can be done in a system-independent way by file.info()$isdir
if(.Platform$OS.type == "unix") {
   system.test <- function(...) { system(paste("test", ...)) == 0 }
   dir.exists <- function(dir) sapply(dir, function(d)system.test("-d", d))
   dir.exists(c(R.home(), "/tmp", "~", "/NO"))# > T T T F
}
\end{ExampleCode}
\end{Examples}

