Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#5405 closed Bugs (fixed)

Filesystem does not handle the path prefix of windows correct

Reported by: michael.kaes@… Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.46.1 Severity: Problem
Keywords: Cc:

Description

The filesystem V3 cannot handle the special windows prefix \\?\ properly. The resulting path and file names are wrong.

A simple example to reproduce the problem

boost::filesystem::path local_path(L"\\\\?\\C:\\");
boost::filesystem::directory_iterator directoryContent(local_path);

const std::wstring name1 = directoryContent->path().filename().wstring();
std::wcout << "Name 1 == " << name1 << std::endl;

++directoryContent;

const std::wstring name2 = directoryContent->path().filename().wstring();
std::wcout << "Name 2 == " << name2 << std::endl;

The output should be the file names on the root folder of drive C. In my case

Name 1 == $Recycle.Bin
Name 2 == 00120.mpls

The observed names are

Name 1 == $Recycle.Bin
Name 2 == C:00120.mpls

The second name is not correct. I traced it down to the root_directory_start function in the path.cpp. Attached is a patch that solved my issue.

Attachments (1)

boost_filesystem.patch (1.2 KB ) - added by michael.kaes@… 12 years ago.
Patch for the described issue

Download all attachments as: .zip

Change History (3)

by michael.kaes@…, 12 years ago

Attachment: boost_filesystem.patch added

Patch for the described issue

comment:1 by Beman Dawes, 12 years ago

Resolution: fixed
Status: newclosed

Your patch will be applied later today.

A new ticket, 5448, has been opened to deal with the more general problem. I'll peck away at that as time permits.

Thanks,

--Beman

comment:2 by Beman Dawes, 12 years ago

(In [71157]) Fix #5405. Note that this is only a partial fix. The issue is much larger; see ticket 5448 for details.

Note: See TracTickets for help on using tickets.