File path separators on Unix systems and Windows are different. On Unix, a forward slash / is used and on Windows a backslash \ is used.
However, when writing Ruby code you don’t need to worry about this; Just use the forward slash / character and it will be cross-platform for you.
An even better option is to use File.join to join a paths together. The correct file path separator for the particular platform will be used. See File.join
When using the File.join method for absolute paths, the first argument to the join method must be an empty string.
Leave a Reply