Opened 7 years ago

#11898 new Bugs

Input stream operator of a filesystem::path can't handle spaces

Reported by: anonymous Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.58.0 Severity: Problem
Keywords: Cc:

Description

The operator>> in filesystem::path breaks at spaces as it would for a std::string, whereas spaces can be an integral part of a path. Concretely, the following code

boost::filesystem::path p;
std::istringstream("path/with spaces") >> p;
std::cout << p << std::endl;

prints "path/with" on OS X 10.11.2. I believe boost::io::quoted is supposed to take care of the spaces in the operator>> implementation

is >> boost::io::quoted(str, static_cast<Char>('&'));

but this doesn't work on my system. (One of the weird points seems to be that it gets called with two arguments, but its declaration requires three and I can't find a default argument declaration.) Replacing the implementation with

std::getline(is, str);

seems to work for me, but I have a feeling that this bypasses some of the necessary logic in boost::io::quoted.

Change History (0)

Note: See TracTickets for help on using tickets.