开发者

Are there any platforms for which the file separator isn't "/"?

开发者 https://www.devze.com 2023-01-30 17:10 出处:网络
To create a path to a file in a platform independent way, you are supposed to use file.path.It bugs me a little that, e.g.,

To create a path to a file in a platform independent way, you are supposed to use file.path. It bugs me a little that, e.g.,

file.path("some dir", "some other dir", "my file")

is more characters and less readable than

"some dir/some other dir/my file"

I want to know if there are any platforms for which the second version will fail. Certainly the path separator (.Platform$file.sep) is / for Linux, Mac and Windows.

Are there any platforms (that R runs on) which have a different value of .Platform$file.sep?

EDIT: The the only current platforms from the Wikipedia list (thanks darioo) that don't use / are OpenVMS, Stratus VOS and Symbian. The FAQ开发者_如何学C on R states that R is developed for

the Unix-like, Windows and Mac families of operating systems

So there is no official support for any of these platforms. I don't have a good feel for whether or not there's an army of hackers running R on their Nokia phones. Can you guesstimate a probability that anyone uses R on these systems?


Here is a list of operating systems with their file separators.

Compare it with the list of OS's on which R runs and you'll have a reference list.

Although, you'll probably stumble upon / in 99% of situations.


\ is the traditional pathseperator in Windows. Some modern Windows Apps, API's handle both versions. But the old style is still the primary.

0

精彩评论

暂无评论...
验证码 换一张
取 消