Opened 11 years ago

Closed 11 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@…

Description

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++) {

new_path/=(*i);

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

For example,

D:\path\file

Becomes,

D:/path\file

Change History (3)

comment:1 by Sachin Garg <schngrg@…>, 11 years ago

Cc: schngrg@… added

comment:2 by Sachin Garg <schngrg@…>, 11 years ago

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

comment:3 by Beman Dawes, 11 years ago

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.

Thanks,

--Beman

Note: See TracTickets for help on using tickets.