Boost C++ Libraries: Ticket #5649: create_directories() fails with NTFS mounted volumes https://svn.boost.org/trac10/ticket/5649 <p> When there is an NTFS mounted volume at some level in the path which is passed to <code>create_directories</code>. The function fails because of the first two checks: </p> <div class="wikipage" style="font-size: 80%"><div class="wiki-code"><div class="code"><pre><span class="n">BOOST_FILESYSTEM_DECL</span> <span class="kt">bool</span> <span class="nf">create_directories</span><span class="p">(</span><span class="k">const</span> <span class="n">path</span><span class="o">&amp;</span> <span class="n">p</span><span class="p">,</span> <span class="n">system</span><span class="o">::</span><span class="n">error_code</span><span class="o">*</span> <span class="n">ec</span><span class="p">)</span> <span class="p">{</span> <span class="k">if</span> <span class="p">(</span><span class="n">p</span><span class="p">.</span><span class="n">empty</span><span class="p">()</span> <span class="o">||</span> <span class="n">exists</span><span class="p">(</span><span class="n">p</span><span class="p">))</span> <span class="p">{</span> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">p</span><span class="p">.</span><span class="n">empty</span><span class="p">()</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="n">is_directory</span><span class="p">(</span><span class="n">p</span><span class="p">))</span> <span class="p">{</span> <span class="p">...</span><span class="k">throws</span><span class="o">/</span><span class="n">returns</span> <span class="n">an</span> <span class="n">error</span><span class="p">...</span> </pre></div></div></div><p> For a mounted volume path p is not <code>empty</code>, it <code>exists</code>, but <code>is_directory(p)</code> fails. This happens because a mounted volume directory is reported by <code>status(p)</code> as <code>file_type::reparse_file</code>. </p> <p> Probably <code>is_directory()</code> should be changed to accept existing NTFS mounted volumes as already existing directories along the path which is to be created. </p> <p> Windows 7 64bit, Boost 1.46.1, filesystem v3, MSVC 9 </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5649 Trac 1.4.3 Michel MORIN <mimomorin@…> Sun, 21 Aug 2011 17:22:13 GMT component changed; owner set https://svn.boost.org/trac10/ticket/5649#comment:1 https://svn.boost.org/trac10/ticket/5649#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Beman Dawes</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">filesystem</span> </li> </ul> Ticket anonymous Mon, 06 Feb 2012 12:16:24 GMT <link>https://svn.boost.org/trac10/ticket/5649#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5649#comment:2</guid> <description> <p> cmd&gt; mkdir d:/bar cmd&gt; mklink /J d:/foo d:/bar cmd&gt; Verbindung erstellt für d:\foo &lt;&lt;===&gt;&gt; d:\bar </p> <p> boost::filesystem::create_directories("d:/foo"); throws boost::filesystem::create_directories: File exists: "d:/foo" </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 06 Sep 2013 20:05:40 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/5649#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/5649#comment:3</guid> <description> <p> in /libs/filesystem/src/operations.cpp (lines 1654-1672) </p> <pre class="wiki"> // reparse point handling; // since GetFileAttributesW does not resolve symlinks, try to open a file // handle to discover if the file exists if (attr &amp; FILE_ATTRIBUTE_REPARSE_POINT) { handle_wrapper h( create_file_handle( p.c_str(), 0, // dwDesiredAccess; attributes only FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, // lpSecurityAttributes OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0)); // hTemplateFile if (h.handle == INVALID_HANDLE_VALUE) { return process_status_failure(p, ec); } if (!is_reparse_point_a_symlink(p)) return file_status(reparse_file, make_permissions(p, attr)); } </pre><p> changing </p> <pre class="wiki">return file_status(reparse_file, make_permissions(p, attr)); </pre><p> to: </p> <p> return file_status(<strong>directory_file</strong>, make_permissions(p, attr)); </p> <p> seems to fix this problem...of course i have no idea what new problems it might cause. </p> </description> <category>Ticket</category> </item> </channel> </rss>