Opened 6 years ago

Closed 6 years ago

#5989 closed Bugs (fixed)

path iterator appends / instead of \ on windows

Reported by: Sachin Garg <schngrg@…> Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.47.0 Severity: Problem
Keywords: Cc: schngrg@…


In boost v1.47, filesystem\v\src\path.cpp, inside function m_path_iterator_increment, on line line 654,

It should be:

it.m_element.m_pathname = preferred_separator;

Instead of

it.m_element.m_pathname = separator;

Reason: In below sample code

boost::filesystem::path new_path; for (fs::path::iterator i=path.begin();i!=path.end();i++) {


On windows when iterating a path using above code, line 654 incorrectly appends / instead of \ after drive letter.

For example,




Attachments (0)

Change History (3)

comment:1 Changed 6 years ago by Sachin Garg <schngrg@…>

Cc: schngrg@… added

comment:2 Changed 6 years ago by Sachin Garg <schngrg@…>

File path is for v3: filesystem\v3\src\path.cpp

comment:3 Changed 6 years ago by Beman Dawes

Resolution: fixed
Status: newclosed

The code is correct as written. Iteration returns the generic format, as this is required for comparison to work correctly.

The reference documentation will been corrected to reflect this, and the source code has been annotated.

The path_test code has also been updated and annotated.



Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Beman Dawes.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.