Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 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?

like image 572
Richie Cotton Avatar asked Dec 16 '10 10:12

Richie Cotton


People also ask

What is the file separator?

A file separator is a character that is used to separate directory names that make up a path to a particular location. This character is operating system specific. On Microsoft Windows, it is a back-slash character (), e.g. C:myprojectmyfilesome.

What is a directory separator?

The directory separator character separates subdirectories within the nested directory hierarchy. An optional filename. The directory separator character separates the file path and the filename.

What is path separator in Java?

pathSeparator is used to separate individual file paths in a list of file paths. Consider on windows, the PATH environment variable. You use a ; to separate the file paths so on Windows File.


2 Answers

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.

like image 87
darioo Avatar answered Oct 19 '22 23:10

darioo


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

like image 22
bernd_k Avatar answered Oct 19 '22 22:10

bernd_k