Boost C++ Libraries: Ticket #7258: boost::filesystem::create_directories(const &path) returns false if the path contains a slash at the end of the string https://svn.boost.org/trac10/ticket/7258 <p> for example, if we want to create that following directory: path="C:/users/test/" </p> <p> the function create_directories(path) returns false even if the directory is created and exists. </p> <p> However, if we remove the slash at the end of the string path="C:/users/test", the function returns true. </p> <p> Is it the normal behavior of that function? </p> <p> Thanks. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7258 Trac 1.4.3 anonymous Mon, 03 Sep 2012 12:39:48 GMT <link>https://svn.boost.org/trac10/ticket/7258#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7258#comment:1</guid> <description> <p> I have same issue! </p> </description> <category>Ticket</category> </item> <item> <author>randydu@…</author> <pubDate>Mon, 10 Sep 2012 15:15:30 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7258#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7258#comment:2</guid> <description> <p> It also happens on Mac. </p> <p> The problem is: </p> <p> path dir("foo/"); dir.parent_path() ==&gt; "foo"; (not "") </p> <p> 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). </p> <p> If the trailing slash is removed: </p> <p> path dir("foo"); dir.parent_path() ==&gt; ""; (now empty: "") </p> <p> then everything works perfectly. </p> <p> So the bug fix is creating a public wrapper of create_directories() to remove trailing slash of input parameter before calling internal create_directories(). </p> <p> Thanks, Randy </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 25 Sep 2013 15:21:29 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7258#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7258#comment:3</guid> <description> <p> I have the same issue!! =) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 02 Oct 2013 10:57:18 GMT</pubDate> <title>version changed https://svn.boost.org/trac10/ticket/7258#comment:4 https://svn.boost.org/trac10/ticket/7258#comment:4 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.52.0</span> → <span class="trac-field-new">Boost 1.55.0</span> </li> </ul> Ticket gilaldpellaeon@… Fri, 26 Dec 2014 11:38:59 GMT version changed https://svn.boost.org/trac10/ticket/7258#comment:5 https://svn.boost.org/trac10/ticket/7258#comment:5 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.55.0</span> → <span class="trac-field-new">Boost 1.57.0</span> </li> </ul> <p> I have the same issue with Boost 1.57.0 (linux). </p> Ticket hadatko Tue, 17 Feb 2015 13:44:06 GMT <link>https://svn.boost.org/trac10/ticket/7258#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7258#comment:6</guid> <description> <p> Still problem 1.55.1 you can make this useful with this if(!boost::filesystem::is_directory(dir)) { </p> <blockquote> <p> boost::filesystem::create_directories(dir); if(!boost::filesystem::is_directory(dir)) { </p> <blockquote> <p> error code </p> </blockquote> <p> } </p> </blockquote> <p> } </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Beman Dawes</dc:creator> <pubDate>Wed, 02 Sep 2015 12:26:29 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7258#comment:7 https://svn.boost.org/trac10/ticket/7258#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed. Also fixed related issues if path contains dot or dot-dot elements, and added test cases to the test suite. </p> <p> The fixes have been applied to the develop branch and will be merged to master once sufficient regression tests have cycled. </p> <p> Thanks, </p> <p> --Beman </p> Ticket anonymous Thu, 08 Oct 2015 19:55:25 GMT status, version changed; resolution deleted https://svn.boost.org/trac10/ticket/7258#comment:8 https://svn.boost.org/trac10/ticket/7258#comment:8 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.57.0</span> → <span class="trac-field-new">Boost 1.59.0</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> Hi, </p> <p> I'm running Boost 1.59 and have found the exact same problem. The bug ISN'T fixed! </p> <p> Thanks ! </p> <hr /> <p> # g++ --version </p> <p> g++ (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 5.2.0 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. </p> <p> g++.exe -Wall -fexceptions -g -march=corei7 -std=c++0x -g -IC:\boost_1_59_0 -c C:\temp\c++\main.cpp -o obj\Debug\main.o g++.exe -LC:\boost_1_59_0\stage\lib -o bin\Debug\_recolle_futures.exe obj\Debug\main.o C:\boost_1_59_0\stage\lib\libboost_system-mgw52-mt-1_59.a C:\boost_1_59_0\stage\lib\libboost_filesystem-mgw52-mt-1_59.a C:\boost_1_59_0\stage\lib\libboost_regex-mgw52-mt-1_59.a C:\boost_1_59_0\stage\lib\libboost_program_options-mgw52-mt-1_59.a C:\boost_1_59_0\stage\lib\libboost_date_time-mgw52-mt-1_59.a C:\boost_1_59_0\stage\lib\libboost_iostreams-mgw52-mt-1_59.a </p> Ticket anonymous Fri, 09 Oct 2015 09:04:02 GMT <link>https://svn.boost.org/trac10/ticket/7258#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7258#comment:9</guid> <description> <p> By the way, I forgot to mention that I'm running Windows 8.1 pro </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Beman Dawes</dc:creator> <pubDate>Fri, 16 Oct 2015 20:04:48 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/7258#comment:10 https://svn.boost.org/trac10/ticket/7258#comment:10 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.60.0</span> </li> </ul> <p> It is fixed in the develop branch for Boost 1.60. Did you test against 1.59 or against the current develop branch of the filesystem repo at <a class="ext-link" href="https://github.com/boostorg/filesystem"><span class="icon">​</span>https://github.com/boostorg/filesystem</a>? </p> <p> If it is still failing for you on the current develop branch, please submit a small program that isolates the problem. </p> <p> Thanks, </p> <p> --Beman </p> Ticket Smithd407 Mon, 02 Jan 2017 07:46:04 GMT type, version, component, severity, milestone changed https://svn.boost.org/trac10/ticket/7258#comment:11 https://svn.boost.org/trac10/ticket/7258#comment:11 <ul> <li><strong>type</strong> <span class="trac-field-old">Bugs</span> → <span class="trac-field-new">Library Submissions</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost 1.59.0</span> → <span class="trac-field-new">Boost.Build-M3</span> </li> <li><strong>component</strong> <span class="trac-field-old">filesystem</span> → <span class="trac-field-new">xpressive</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Problem</span> → <span class="trac-field-new">Not Applicable</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.60.0</span> → <span class="trac-field-new">Website 1.X</span> </li> </ul> <p> Thanksamundo for the post.Really thank you! Awesome. ekegdddkdcadbkgf </p> Ticket Kohei Takahashi Mon, 02 Jan 2017 08:39:12 GMT type, version, component, severity, milestone changed https://svn.boost.org/trac10/ticket/7258#comment:12 https://svn.boost.org/trac10/ticket/7258#comment:12 <ul> <li><strong>type</strong> <span class="trac-field-old">Library Submissions</span> → <span class="trac-field-new">Bugs</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost.Build-M3</span> → <span class="trac-field-new">Boost 1.59.0</span> </li> <li><strong>component</strong> <span class="trac-field-old">xpressive</span> → <span class="trac-field-new">filesystem</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Not Applicable</span> → <span class="trac-field-new">Problem</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Website 1.X</span> → <span class="trac-field-new">To Be Determined</span> </li> </ul> <p> I couldn't undo milestone to 1.60 due to closed. </p> Ticket