Re: [Boost-bugs] [Boost C++ Libraries] #7258: boost::filesystem::create_directories(const &path) returns false if the path contains a slash at the end of the string

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7258: boost::filesystem::create_directories(const &path) returns false if the path contains a slash at the end of the string
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-09-10 15:15:31


#7258: boost::filesystem::create_directories(const &path) returns false if the
path contains a slash at the end of the string
--------------------------------------+-------------------------------------
  Reporter: francis.thibault@… | Owner: bemandawes
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: filesystem
   Version: Boost 1.52.0 | Severity: Problem
Resolution: | Keywords: create_directories()
--------------------------------------+-------------------------------------

Comment (by randydu@…):

 It also happens on Mac.

 The problem is:

 path dir("foo/");
 dir.parent_path() ==> "foo"; (not "")

 hence when create_directories() is called, according to the current
 implementation (operations.cpp), the parent_path is created ("foo") first,
 then create_directory("foo/") is called and returns FALSE with an error
 (BOOST_ERROR_ALREADY_EXISTS).

 If the trailing slash is removed:

 path dir("foo");
 dir.parent_path() ==> ""; (now empty: "")

 then everything works perfectly.


 So the bug fix is creating a public wrapper of create_directories() to
 remove trailing slash of input parameter before calling internal
 create_directories().

 Thanks,
 Randy

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7258#comment:2>
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:10 UTC