\HeaderA{.Platform}{Platform Specific Variables}{.Platform}
\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 string, giving the \bold{O}perating \bold{S}ystem
(family) of the computer.  One of \code{"unix"} or \code{"windows"}.

\item[\code{file.sep}] character string, giving the \bold{file} \bold{sep}arator used on your
platform: \code{"/"} on both Unix-alikes \emph{and} on Windows (but
not on the now abandoned port to Classic MacOS).

\item[\code{dynlib.ext}] character string, giving the file name \bold{ext}ension of
\bold{dyn}amically loadable \bold{lib}raries, e.g., \code{".dll"} on
Windows and \code{".so"} or \code{".sl"} on Unix-alikes.  (Note for
MacOS X users: these are shared objects as loaded by
\code{\LinkA{dyn.load}{dyn.load}} and not dylibs.)

\item[\code{GUI}] character string, giving the type of GUI in use, or \code{"unknown"}
if no GUI can be assumed.  Possible values are for Unix-alikes the
values given via the \option{-g} command-line flag (\code{"X11"},
\code{"Tk"}, \code{"none"} and perhaps others under alternative
front-ends or embedded \R), \code{"AQUA"} (running under
\code{R.app} on MacOS X), \code{"RGui"} and \code{"RTerm"} (Windows).

\item[\code{endian}] character string, \code{"big"} or \code{"little"}, giving the
endianness of the processor in use.  This is relevant when it is
necessary to know the order to read/write bytes of e.g. an integer or
double from/to a connection: see \code{\LinkA{readBin}{readBin}}. 

\item[\code{pkgType}] character string, the preferred setting for
\code{\LinkA{options}{options}("pkgType")}. Values \code{"source"},
\code{"mac.binary"} and \code{"win.binary"} are currently in use.

\item[\code{path.sep}] character string, giving the \bold{path} \bold{sep}arator,
used on your platform, e.g., \code{":"} on Unix-alikes and
\code{";"} on Windows.  Used to separate paths in variables
such as \code{PATH} and \code{TEXINPUTS}.

\item[\code{r\_arch}] character string, possibly \code{""}.  The name of the
architecture-specific directories used in this build of \R.

\end{ldescription}
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{R.version}{R.version}} and \code{\LinkA{Sys.info}{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{\LinkA{.Machine}{.Machine}} for details of the arithmetic used, and
\code{\LinkA{system}{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}

