[Boost-bugs] [Boost C++ Libraries] #6813: canonical function converts root-directory separator from '\' to '/' on Windows

Subject: [Boost-bugs] [Boost C++ Libraries] #6813: canonical function converts root-directory separator from '\' to '/' on Windows
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-04-20 22:19:33


#6813: canonical function converts root-directory separator from '\' to '/' on
Windows
-----------------------------------------------------+----------------------
 Reporter: Alex Goldberg <alex.goldberg@…> | Owner: bemandawes
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: filesystem
  Version: Boost 1.49.0 | Severity: Problem
 Keywords: canonical |
-----------------------------------------------------+----------------------
 boost::filesystem::canonical reverses the path separator on rooted paths

 Consider the following line:
 {{{
 boost::filesystem::path convertedPath =
 boost::filesystem::canonical("C:\\Foo\\Bar\\..\\Bar\\Baz");
 }}}

 On Windows, convertedPath is set to "C:/Foo\Bar\Baz", where I would expect
 it to be set to "C:\Foo\Bar\Baz"

 The documentation states: "Returns: A canonical path that refers to the
 same file system object as absolute(p,base)."

 If the input path has no symbolic links, 'dot' directories, or 'dot-dot'
 directories, then I would expect the output to match a call to
 boost::filesystem::absolute.

 For example:
 {{{
 boost::filesystem::path canonicalPath =
 boost::filesystem::canonical("Bar\\Baz", "C:\\Foo");
 boost::filesystem::path absolutePath =
 boost::filesystem::absolute("Bar\\Baz", "C:\\Foo");
 }}}

 canonicalPath is set to "C:/Foo\Bar\Baz", while absolutePath is set to
 "C:\Foo\Bar\Baz".

 Looking at the implementation, this is related to the issue in ticket 5989
 (https://svn.boost.org/trac/boost/ticket/5989). I agree with the
 sentiments in that ticket, but if the behavior of the path iterator will
 not be changing, then I think the canonical function should be updated to
 preseve path consistency in Windows.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/6813>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC