Is there a way to obtain the platform\'s path separator character using Boost.Filesystem? By path separator, I mean /
for Unix and \\
for Windows.
It seems like boost::filesystem::path::make_preferred is the ticket:
Effects: The contained pathname is converted to the preferred native format. [Note: On Windows, the effect is to replace slashes with backslashes. On POSIX, there is no effect. -- end note]
Example:
namespace bfs = boost::filesystem;
bfs::path slash("/");
bfs::path::string_type preferredSlash = slash.make_preferred().native();