From: John Maddock (John_Maddock_at_[hidden])
Date: 2002-01-30 07:07:37
>It depends. Many times yes. Much of the software I have worked on recently
>needed to create and store paths that worked on UNIX and Windows. Since
>Windows handles forward slashes but UNIX doesn't handle backslashes we
>converted everything to forward slashes.
>Even without that need though, if I create a directory programmatically
>part of the name comes from the user then I could easily have mixed
>separators. For instance, if the user entered "projects\myclass.cpp" and I
>appended that to "/home/jason" then the result is
>"/home/jason/projects\myclass.cpp". To convert this to backslashes, the
>policy needs to recognize that both slash and backslash are valid
>separators on Win32.
Surely the whole point is that we would use the pathname class to handle
programmatic creation of pathnames:
pathname path; // current directory
std::cout << path;
prints ./foo/bar on unix but .\foo\bar on win32 and :foo:bar on the mac.
- John Maddock
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk