Opened 11 years ago
Closed 11 years ago
#5989 closed Bugs (fixed)
path iterator appends / instead of \ on windows
| Reported by: | 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 , 11 years ago
| Cc: | added |
|---|
comment:2 by , 11 years ago
comment:3 by , 11 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
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

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