[R-SIG-Mac] Path separator issues in OSX 10.5
simon.urbanek at r-project.org
Wed Jan 21 20:47:35 CET 2009
On Jan 21, 2009, at 13:15 , Ben Tupper wrote:
> I have a new Mac OSX 10.5 iMac running R 2.8.1. Using Finder, I
> manually created a folder for R source code as /Users/Shared/code/R.
> If I use R.app's "Misc>Change Working Directory..." menu dialog to
> navigate to /Users/Shared/code/R and then use getwd() to print the
> directory path, the components of the path are separated with colons
> as shown: /Users/Shared/Shared:code/Shared:code:R
> The R function file.path() does not produces these colon-ized paths.
Why should it? The colon is part of the name - the name of your
directory is "Shared:code" so the proper use of file.path is
BTW: I suspect you are not quite aware of what you're doing in your
Finder - you're creating files/directories that have a slash in their
name which the Finder re-maps to colons. This has nothing to do with R
- it's a historic work-around in the Finder from times when / was
valid in file names in OS 9 and I suspect you didn't really mean to
create those files/directories that way...
> I have pasted below the commands I used as well as the output of
> sessionInfo(). Additionally, I have provided the output of the ls
> command from the Terminal which also appears to use the colon-ized
> I cannot replicate this issue in OSX 10.4.11 and R 2.8.1. I am not
> sure how to proceed and suggestions are most welcome.
> # file.path() creates the paths with the path separator "/"
> > ROOTDIR <- file.path("/", "Users", "Shared")
> > file.path(ROOTDIR, "code", "R")
>  "//Users/Shared/code/R"
> # but according to the dir() it is unreadable
> > dir(file.path(ROOTDIR, "code", "R"))
> Warning message:
> In dir(file.path(ROOTDIR, "code", "R")) :
> list.files: '//Users/Shared/code/R' is not a readable directory
> # use R.app's Misc>Change Working Directory...
> # to change to "/Users/Shared/code/R"
> > getwd()
>  "/Users/Shared/Shared:code/Shared:code:R"
> > sessionInfo()
> R version 2.8.1 (2008-12-22)
> attached base packages:
>  stats graphics grDevices utils datasets methods base
> From Terminal...
> Henry:Shared Brian$ ls
> SC Info Shared:code Shared:data
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
More information about the R-SIG-Mac