From 111b40ace44deec492854423031a9c2b34cee554 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Wed, 3 Jan 2024 03:35:20 +0300 Subject: [PATCH] Rework path::generic_path to remove duplicate separators and retain root name. std::filesystem::path::generic_string mandates that the returned string uses *single* forward slashes for directory separators, which means any duplicates must be removed. Boost.Filesystem now follows this definition, and also documents that forward slashes are used for directory separators. Additionally, since only directory separators are supposed to be affected, avoid converting any slashes that are part of the path root name. This is the case on Windows with UNC paths and Windows-specific path prefixes. Closes https://github.com/boostorg/filesystem/issues/299. --- doc/reference.html | 3 ++- doc/release_history.html | 5 ++++ include/boost/filesystem/path.hpp | 21 +-------------- src/path.cpp | 43 ++++++++++++++++++++++++++++--- test/path_test.cpp | 41 +++++++++++++++++++++++++++++ 5 files changed, 88 insertions(+), 25 deletions(-) diff --git a/doc/reference.html b/doc/reference.html index bd46bacf3..09d3e0ec2 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -1582,7 +1582,8 @@

path path generic format observers [path.generic.obs]

-

The string returned by all generic format observers is in the generic pathname format.

+

The string returned by all generic format observers is in the generic pathname format. +The returned strings use a single forward slash ('/') as directory separators.

template <class String>
 String generic_string(const codecvt_type& cvt=codecvt()) const;
diff --git a/doc/release_history.html b/doc/release_history.html index 3893f3fc3..6f5c070a6 100644 --- a/doc/release_history.html +++ b/doc/release_history.html @@ -39,6 +39,11 @@ +

1.85.0

+ +

1.84.0