Boost C++ Libraries: Ticket #13428: Windows: "is_symlink" for drive letter (without trailing directory separator) returns the wrong result https://svn.boost.org/trac10/ticket/13428 <p> Suppose you have a normal directory <code>Dir</code> and a symlink named <code>SymlinkToDir</code> which points to <code>Dir</code> on drive <code>C:\</code>. </p> <p> The following two tests lead to different results: </p> <pre class="wiki">boost::filesystem::path fsPathToSymlink("C:\\SymlinkToDir"); boost::filesystem::path fsPathToDrive("C:"); current_path(fsPathToDrive + "\\"); bool b1 = is_symlink(fsPathToDrive); assert( b1 == false ); current_path(fsPathToSymlink); bool b2 = is_symlink(fsPathToDrive); assert( b2 == true ); </pre><p> It seems that Windows differentiates between <code>C:</code> and <code>C:\</code>. The first form seems to denote the current directory on drive <code>C:\</code> while the second form seems to denote drive <code>C:\</code> itself. This also can be observed in the Windows command promt. </p> <p> <code>is_symlink</code> internally uses <code>GetFileAttributesW</code> to determine the symlink status. <code>GetFileAttributes("C:")</code> returns the file attributes of <code>C:\\SymlinkToDir</code> instead of <code>C:\</code>. </p> <p> The function <code>is_symlink</code> is used to implement other functions, so this problem also effects at least the following other functions, possibly even many more: </p> <ul><li><code>canonical</code> returns <code>BOOST_ERROR_NOT_SUPPORTED</code> for an absolute path, if compiled for Windows versions earlier than Windows Vista (<code>_WIN32_WINNT &lt; 0x0600</code>) and the current directory represents a symlink. </li></ul><ul><li><code>weakly_canonical</code> in the same scenario as above, because this utilizes <code>canonical</code>. </li></ul> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13428 Trac 1.4.3