[filesystem] path iterator appends / instead of \ on windows

In boost v1.47, filesystem\v3\src\path.cpp, inside function m_path_iterator_increment, on 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 I have created a trac ticket for the same: https://svn.boost.org/trac/boost/ticket/5989 SG

On Fri, Oct 7, 2011 at 12:55 AM, Sachin Garg
In boost v1.47, filesystem\v3\src\path.cpp, inside function m_path_iterator_increment, on 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.
I can't speak for the Boost implementation along these lines, however, I am fairly certain that most (*recent* APIs anyway, such as .NET File, Directory, etc), will support either '/' or '\' with consistent results.
For example, D:\path\file Becomes, D:/path\file
I have created a trac ticket for the same: https://svn.boost.org/trac/boost/ticket/5989
SG
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

On Fri, Oct 7, 2011 at 3:38 PM, Michael Powell
On Fri, Oct 7, 2011 at 12:55 AM, Sachin Garg
wrote: In boost v1.47, filesystem\v3\src\path.cpp, inside function m_path_iterator_increment, on 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.
I can't speak for the Boost implementation along these lines, however, I am fairly certain that most (*recent* APIs anyway, such as .NET File, Directory, etc), will support either '/' or '\' with consistent results.
Yes, paths with either 'one' of forward slashes or back slashes work, but both Win32 and C API fail with the 'mixed' slash paths that this results in, eg D:/path\file SG
participants (2)
-
Michael Powell
-
Sachin Garg