[R-SIG-Mac] Path separator issues in OSX 10.5
Ben Tupper
PemaquidRiver at tidewater.net
Wed Jan 21 21:51:26 CET 2009
On Jan 21, 2009, at 2:47 PM, Simon Urbanek wrote:
>
> On Jan 21, 2009, at 13:15 , Ben Tupper wrote:
>
>> Hello,
>>
>> 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
> > file.path("/Users","Shared","Shared:Code","Shared:code:R")
> [1] "/Users/Shared/Shared:Code/Shared:code:R"
>
> 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...
>
Bingo! Thanks for the explanation, Simon. Your hunch that each
manually created directory was created with a "/" prefix is exactly
right. You are right that it was unintentional, and I won't even try
to explain how that happened.
Thanks again and cheers,
Ben
> Cheers,
> S
>
>
>> 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
>> form.
>>
>> 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.
>>
>> Thanks,
>> Ben
>>
>>
>>
>> # file.path() creates the paths with the path separator "/"
>> > ROOTDIR <- file.path("/", "Users", "Shared")
>> > file.path(ROOTDIR, "code", "R")
>> [1] "//Users/Shared/code/R"
>>
>> # but according to the dir() it is unreadable
>> > dir(file.path(ROOTDIR, "code", "R"))
>> character(0)
>> 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()
>> [1] "/Users/Shared/Shared:code/Shared:code:R"
>>
>>
>> > sessionInfo()
>> R version 2.8.1 (2008-12-22)
>> i386-apple-darwin8.11.1
>>
>> locale:
>> en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
>>
>> attached base packages:
>> [1] stats graphics grDevices utils datasets methods base
>> >
>>
>>
>> From Terminal...
>> Henry:Shared Brian$ ls
>> SC Info Shared:code Shared:data
>> Shared:doc
>>
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>
>>
>
More information about the R-SIG-Mac
mailing list