Opened 10 years ago

Closed 10 years ago

#8053 closed Bugs (invalid)

Path composition on Windows fails using drive letters

Reported by: anonymous Owned by: Beman Dawes
Milestone: To Be Determined Component: filesystem
Version: Boost 1.52.0 Severity: Problem
Keywords: Cc:

Description

When composing paths on Windows invalid paths are created, when the first path is only a drive letter, as shown in the following example.

fs::path root = "C:";
fs::path dir = root / "folder";
// dir is now "C:folder", expecting "C:/folder"

Tested with MSVC++10 on Win7.

Change History (1)

comment:1 by Beman Dawes, 10 years ago

Resolution: invalid
Status: newclosed

The current behavior is correct. In the class path append specs in the reference docs, see the second bullet item in the list of conditions which prevent appending the separator being appended: "would change an relative path to an absolute path". Since "C:" is a relative path on Windows, a separator is not appended, and this is by design.

Thanks,

--Beman

Note: See TracTickets for help on using tickets.