Re: [Rd] file separator inconsistencies on windows?

From: Prof Brian Ripley <>
Date: Mon, 14 May 2007 17:20:33 +0100 (BST)

On Mon, 14 May 2007, Ernest Turro wrote:

> tempdir() on windows returns the path using "\\" as file separator.

Yes, it is explicitly documented to.

> But .Platform$file.sep returns "/". As a result, you get
> inconsistencies like:
> > file.path(tempdir(), "foo")
> [1] "C:\\WINDOWS\\Temp\\RtmpYEIXrb/foo" # Mix of \\ and /
> I'm not sure if this can cause problems but I thought I'd let you
> know just in case.

It doesn't cause problems AFAIK. The main place you need \ is when passing filepaths to a Windows shell, a few Windows executables and a very few API functions (where we convert in the wrappers). OTOH, / is needed when passing to a Unix-like shell, make ....

Note that e.g. shell() on Windows has an argument to translate / to \ if necessary.

There is a problem with network shares like \\machine\path\to\file. Those are essentially incompatible with POSIX and a lot of the tools we use for R, but I've started to make them work as far as is practicable.

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
Received on Mon 14 May 2007 - 16:26:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 May 2007 - 16:33:46 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.