Ticket #455 (new enhancement)

Opened 7 years ago

Is backslash separator necessary in changeset 6059?

Reported by: baker Owned by: somebody
Priority: minor Milestone: All Platforms
Component: ALL modules Version: 7.8
Keywords: Path separator Cc:

Description

Is the backslash separator actually necessary in changeset 6059?

According to http://stackoverflow.com/questions/8881806/file-separator-for-windows-and-unix, the Windows C library accepts forward slashes in path separators:

The simple answer is to just use / on both. Even though Windows requires \ when
you're specifying a path separator on the command line, when passed in an argument
CreateFile, you can use '/' as the path separator with no problems at all.

This has been true all the way back to MS-DOS 2.0 (the first to support
subdirectories and paths at all). Though it didn't last very long, there were even
versions of DOS that allowed you to change the switchar to '-', so it allowed / as
the path separator even on the command line.

However, this does not say that you can mix the two. That could be tested.

If the separate code to use one or the other is going to stay, or is used elsewhere, the sense of the conditional for the C preprocessor should be reversed. I.e., make WIN32 the test to use a backslash path separator, and use a forward slash for all others. (Is an Android port coming?) Better yet, globally define a symbolic name for the path separator in the system-dependent header files and don't use any conditional code. That will make future porting to other OS's easier.

Note: See TracTickets for help on using tickets.