diff --git a/doc/deprecated.html b/doc/deprecated.html
index 939a8eb..2e276e0 100644
--- a/doc/deprecated.html
+++ b/doc/deprecated.html
@@ -63,162 +63,6 @@ can be suppressed by defining BOOST_FILESYSTEM_ALLOW_DEPRECATED mac
New name
class pathbranch_path()parent_path()class pathcanonize()class pathdefault_name_check()class pathdefault_name_check(name_check)class pathdefault_name_check_writable()class pathdirectory_string()stringclass pathexternal_directory_string()native()class pathexternal_file_string()native()class pathfile_string()string()class pathhas_branch_path()has_parent_path()class pathhas_leaf()has_filename()class pathis_complete()is_absolute()class pathleaf()filename()class pathnative_directory_string()string()class pathnative_file_string()string()class pathnormalize()class pathpath(const string_type& str, name_check)name_check
- argument.class pathpath(const string_type::value_type* s, name_check)name_check
- argument.class pathremove_leaf()
remove_filename()
class pathBOOST_FILESYSTEM_ALLOW_DEPRECATED mac
class pathpath.hpptypedef basic_path<std::wstring, wpath_traits> wpathclass path instead. Workaround provides
- typedef path wpathoperations.hppBOOST_FILESYSTEM_ALLOW_DEPRECATED mac
operations.hpptemplate <class Path>
- Path complete(const Path& p,
- const Path& base=
- initial_path<Path>())
path absolute(const path& p, const path& base=
- current_path())
operations.hppis_regular(file_status f)
- is_regular_file(file_status f)
operations.hppsymbolic_link_exists(const path& ph)operations.hppcopy_directory(const path& from, const path& to)create_directory(const path& to, const path& from) instead (note the reversed order of arguments)class directory_entryfilename()path().filename() instead.class directory_entryleaf()path().filename() instead.class directory_entrystring()path().string() instead.class recursive_directory_iteratorlevel()depth()class recursive_directory_iteratorno_push_pending()!recursion_pending()class recursive_directory_iteratorno_push()disable_recursion_pending()directory.hppenum class symlink_optionenum class directory_options instead.directory.hppwrecursive_directory_iterator typedefclass recursive_directory_iterator instead. Workaround provides
- typedef recursive_directory_iterator wrecursive_directory_iteratoroperations.hppfilesystem_error, file_status, directory_entry, directory_iterator, recursive_directory_iterator and associated enums and functions.exception.hpp, file_status.hpp and directory.hpp.
- The workaround is to include the new headers or filesystem.hpp. The new headers are still included by operations.hpp if
- BOOST_FILESYSTEM_NO_DEPRECATED is not defined.path_traits.hpppath.BOOST_FILESYSTEM_NO_DEPRECATED is defined and will be permanently removed in a future release.BOOST_WINDOW_APIBOOST_POSIX_APIBOOST_WINDOW_PATHBOOST_POSIX_PATH© Copyright Beman Dawes, 2002-2005, 2010
-© Copyright Andrey Semashev, 2019-2021
+© Copyright Andrey Semashev, 2019-2024
Use, modification, and distribution are subject to the Boost Software License, Version 1.0. See www.boost.org/LICENSE_1_0.txt
diff --git a/doc/reference.html b/doc/reference.html index 9d7edf8..998d842 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -718,14 +718,6 @@ nothing else." create_hard_links }; - // Deprecated, use copy_options instead - enum class copy_option - { - none = copy_options::none, - fail_if_exists = none, - overwrite_if_exists = copy_options::overwrite_existing - }; - enum class directory_options { none = 0u, @@ -734,14 +726,6 @@ nothing else." pop_on_error }; - // Deprecated, use directory_options instead - enum class symlink_option - { - none = directory_options::none, - no_recurse = none, - recurse = directory_options::follow_directory_symlink - }; - // operational functions path absolute(const path& p, const path& base=current_path()); @@ -762,11 +746,6 @@ nothing else." void copy(const path& from, const path& to, copy_options options, system::error_code& ec); - // Deprecated, use create_directory instead - void copy_directory(const path& from, const path& to); - void copy_directory(const path& from, const path& to, - system::error_code& ec); - bool copy_file(const path& from, const path& to); bool copy_file(const path& from, const path& to, system::error_code& ec); @@ -774,11 +753,6 @@ nothing else." copy_options options); bool copy_file(const path& from, const path& to, copy_options options, system::error_code& ec); - // Deprecated, use overloads taking copy_options instead - bool copy_file(const path& from, const path& to, - copy_option options); - bool copy_file(const path& from, const path& to, - copy_option options, system::error_code& ec); void copy_symlink(const path& existing_symlink, const path& new_symlink); @@ -1921,27 +1895,6 @@ out-live the iterator itself. —end note] -path deprecated functions Several member functions from previous versions of class path have been deprecated, either because they have been renamed or because the
-functionality is no longer desirable or has become obsolete.
Deprecated functions available by default; will be suppressed if BOOST_FILESYSTEM_NO_DEPRECATED is defined:
- path& remove_leaf() { return remove_filename(); }
-path leaf() const { return filename(); }
-path branch_path() const { return parent_path(); }
-bool has_leaf() const { return !m_path.empty(); }
-bool has_branch_path() const { return !parent_path().empty(); }
-
- Deprecated functions not available by default; will be supplied if BOOST_FILESYSTEM_DEPRECATED is defined:
-const std::string file_string() const { return native_string(); }
-const std::string directory_string() const { return native_string(); }
-const std::string native_file_string() const { return native_string(); }
-const std::string native_directory_string() const { return native_string(); }
-const string_type external_file_string() const { return native(); }
-const string_type external_directory_string() const { return native(); }
-
-
path non-member functions
[path.non-member]directory_iterator unless otherwise specified.
explicit recursive_directory_iterator(const path& p, directory_options opts = directory_options::none); recursive_directory_iterator(const path& p, directory_options opts, system::error_code& ec); -explicit recursive_directory_iterator(const path& p, symlink_option opts = symlink_option::none); -recursive_directory_iterator(const path& p, symlink_option opts, system::error_code& ec); -recursive_+recursive_directory_iterator(const path& p, system::error_code& ec);directory_iterator(const path& p, system::error_code& ec);
-Effects: Constructs an iterator representing the first @@ -3029,8 +2968,7 @@ For the signature without the
optsargument,optsis a[Note: By default,
recursive_directory_iteratordoes not follow directory symlinks. To follow directory symlinks, specifydirectory_options::follow_directory_symlinkinopts. —end note]
int depth() const noexcept; -int level() const noexcept;+
int depth() const noexcept;
-Requires:
*this != recursive_directory_iterator().Returns:
@@ -3040,12 +2978,7 @@ int level() const noexcept;m_depth.Requires:
*this != recursive_directory_iterator().Returns:
m_recursion_pending.
bool no_push_pending() const noexcept;-
--Requires:
-*this != recursive_directory_iterator().Returns:
-!recursion_pending().
-recursive_directory_iterator& operator++(); +recursive_directory_iterator& operator++(); recursive_directory_iterator& increment(system::error_code& ec);@@ -3101,8 +3034,7 @@ void pop(system::error_code& ec);
void disable_recursion_pending(bool value = true) noexcept; -void no_push(bool value = true) noexcept;+
void disable_recursion_pending(bool value = true) noexcept;
-Requires:
*this != recursive_directory_iterator().Postcondition:
@@ -3255,25 +3187,6 @@ void copy(const path& from, const path& to, copy Otherwise, for all unsupported file types ofrecursion_pending() == !value.freport error.Throws: As specified in Error reporting.
- -
void copy_directory(const path& from, const path& to); -void copy_directory(const path& from, const path& to, system::error_code& ec);-
-Effects: Creates directory
- -to, with - attributes copied from directoryfrom. The set of attributes - copied is operating system dependent.[Note: For ISO 9945/POSIX based operating systems the - attributes are those copied by native API
stat(from.c_str(), &from_stat)- followed bymkdir(to.c_str(),from_stat.st_mode). For - Windows based operating systems the attributes are those copied by native - APICreateDirectoryExW(from.c_str(), to.c_str(), 0). - —end note] - -Throws: As specified in Error reporting.
- -[Note: This operation is deprecated, use create_directory instead. —end note]
bool copy_file(const path& from, const path& to); @@ -3285,9 +3198,7 @@ bool copy_file(const path& from, const path& to, system::error_code&bool copy_file(const path& from, const path& to, copy_options options); -bool copy_file(const path& from, const path& to, copy_options options, system::error_code& ec); -bool copy_file(const path& from, const path& to, copy_option options); -bool copy_file(const path& from, const path& to, copy_option options, system::error_code& ec);+bool copy_file(const path& from, const path& to, copy_options options, system::error_code& ec);
Precondition:
optionsmust contain at most one option from each of the following groups:@@ -3317,7 +3228,6 @@ bool copy_file(const path& from, const path& to,
Returns:
trueif the file was copied without error, otherwisefalse.Throws: As specified in Error reporting.
-[Note: The overloads taking
copy_optionare deprecated. Their effect is equivalent to the corresponding overloads takingcopy_optionsafter casting theoptionsargument tocopy_options.][Note: When
copy_options::update_existingis specified, checking the write times offromandtomay not be atomic with the copy operation. Another process may create or modify the file identified bytoafter the file modification times have been checked but before copying starts. In this case the target file will be overwritten.][Note: The
copy_options::synchronize_dataandcopy_options::synchronizeoptions may have a significant performance impact. Thecopy_options::synchronize_dataoption may be less expensive thancopy_options::synchronize. However, without these options, upon returning fromcopy_fileit is not guaranteed that the copied file is completely written and preserved in case of a system failure. Any delayed write operations may fail after the function returns, at the point of physically writing the data to the underlying media, and this error will not be reported to the caller.][Note: The
diff --git a/doc/release_history.html b/doc/release_history.html index 47d0cf6..77cb073 100644 --- a/doc/release_history.html +++ b/doc/release_history.html @@ -49,6 +49,8 @@copy_options::ignore_attribute_errorsoption can be used when the caller does not require file attributes to be copied. The implementation is permitted to make an attempt to copy the file attributes, but still succeed the file copying operation if that attempt fails. This option may be useful with file systems that do not fully support operations of file attributes.]weakly_canonicalnow produces an absolute path if the input path is relative and contains no elements that exist in the filesystem. (#300)- Added a new
copy_options::ignore_attribute_errorsoption forcopy_fileandcopyoperations. The new option allows to ignore possible errors while copying file attributes. (#179)- On Linux,
+copy_filebackends based onsendfileandcopy_file_rangesystem calls will attempt to preallocate storage for the target file. This may reduce filesystem fragmentation and provide early error indication if there is not enough free space. Not all filesystems support this feature; file copying proceeds if storage preallocation is not supported.- Removed APIs that were previously declared deprecated. In particular,
+pathandrecursive_directory_iteratormember functions,is_regular,copy_directory,symbolic_link_exists,complete,copy_option,symlink_option, as well asboost/filesystem/convenience.hppandboost/filesystem/path_traits.hppheaders were removed.- Support for
pathconstruction, assignment and appending from container types (e.g.std::vector<char>) is now disabled by default. Users can still enable this functionality by definingBOOST_FILESYSTEM_DEPRECATED. This functionality remains deprecated and will be completely removed in a future release.1.84.0
diff --git a/doc/tutorial.html b/doc/tutorial.html index e6a8689..aff8062 100644 --- a/doc/tutorial.html +++ b/doc/tutorial.html @@ -806,7 +806,7 @@ more flexible because classpathitself is far more flexible:Class pathsupports multiple character types and encodings, including Unicode, to ease internationalization.Class pathsupports multiple source types, such as iterators for null terminated - sequences, iterator ranges, containers (includingstd::basic_string), + sequences, iterator ranges, string class types (includingstd::basic_stringandstd::basic_string_view), anddirectory_entry's, so functions taking paths don't need to provide several overloads.Class pathsupports both native and generic pathname formats, so programs can be @@ -862,8 +862,8 @@ int main() { fs::ofstream f(L"smile\u263A"); } { fs::ofstream f(narrow_string); } { fs::ofstream f(wide_string); } - { fs::ofstream f(narrow_list); } - { fs::ofstream f(wide_list); } + { fs::ofstream f(fs::path(narrow_list.begin(), narrow_list.end())); } + { fs::ofstream f(fs::path(wide_list.begin(), wide_list.end())); } narrow_list.pop_back(); narrow_list.push_back('4'); wide_list.pop_back(); diff --git a/example/tut5.cpp b/example/tut5.cpp index dbef00d..b9dd00d 100644 --- a/example/tut5.cpp +++ b/example/tut5.cpp @@ -47,10 +47,10 @@ int main() fs::ofstream f(wide_string); } { - fs::ofstream f(narrow_list); + fs::ofstream f(fs::path(narrow_list.begin(), narrow_list.end())); } { - fs::ofstream f(wide_list); + fs::ofstream f(fs::path(wide_list.begin(), wide_list.end())); } narrow_list.pop_back(); narrow_list.push_back('4'); diff --git a/include/boost/filesystem.hpp b/include/boost/filesystem.hpp index 8b14800..ee22fbc 100644 --- a/include/boost/filesystem.hpp +++ b/include/boost/filesystem.hpp @@ -18,6 +18,5 @@ #include#include #include -#include #endif // BOOST_FILESYSTEM_FILESYSTEM_HPP diff --git a/include/boost/filesystem/convenience.hpp b/include/boost/filesystem/convenience.hpp deleted file mode 100644 index d66add2..0000000 --- a/include/boost/filesystem/convenience.hpp +++ /dev/null @@ -1,55 +0,0 @@ -// boost/filesystem/convenience.hpp ----------------------------------------// - -// Copyright Beman Dawes, 2002-2005 -// Copyright Vladimir Prus, 2002 - -// Use, modification, and distribution is subject to the Boost Software -// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -// See library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM_CONVENIENCE_HPP -#define BOOST_FILESYSTEM_CONVENIENCE_HPP - -#include -#include -#include - -#include // must be the last #include - -namespace boost { -namespace filesystem { - -#ifndef BOOST_FILESYSTEM_NO_DEPRECATED - -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::extension() instead") -inline std::string extension(const path& p) -{ - return p.extension().string(); -} - -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::stem() instead") -inline std::string basename(const path& p) -{ - return p.stem().string(); -} - -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::replace_extension() instead") -inline path change_extension(const path& p, const path& new_extension) -{ - path new_p(p); - new_p.replace_extension(new_extension); - return new_p; -} - -#endif - -} // namespace filesystem -} // namespace boost - -#include - -#endif // BOOST_FILESYSTEM_CONVENIENCE_HPP diff --git a/include/boost/filesystem/detail/path_traits.hpp b/include/boost/filesystem/detail/path_traits.hpp index 35d0e8b..5e1af2c 100644 --- a/include/boost/filesystem/detail/path_traits.hpp +++ b/include/boost/filesystem/detail/path_traits.hpp @@ -32,7 +32,7 @@ #include #include #endif -#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) && BOOST_FILESYSTEM_VERSION < 4 +#if defined(BOOST_FILESYSTEM_DEPRECATED) && BOOST_FILESYSTEM_VERSION < 4 #include #include #endif @@ -256,7 +256,7 @@ struct path_source_traits< boost::basic_string_view< wchar_t, std::char_traits< static BOOST_CONSTEXPR_OR_CONST bool is_native = false; }; -#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) && BOOST_FILESYSTEM_VERSION < 4 +#if defined(BOOST_FILESYSTEM_DEPRECATED) && BOOST_FILESYSTEM_VERSION < 4 template< > struct BOOST_FILESYSTEM_DETAIL_DEPRECATED("Boost.Filesystem path construction/assignment/appending from containers is deprecated, use strings or iterators instead.") @@ -298,7 +298,7 @@ path_source_traits< std::list< wchar_t > > typedef wchar_t char_type; static BOOST_CONSTEXPR_OR_CONST bool is_native = false; }; -#endif // !defined(BOOST_FILESYSTEM_NO_DEPRECATED) && BOOST_FILESYSTEM_VERSION < 4 +#endif // defined(BOOST_FILESYSTEM_DEPRECATED) && BOOST_FILESYSTEM_VERSION < 4 template< > struct path_source_traits< directory_entry > @@ -437,7 +437,7 @@ BOOST_FORCEINLINE typename Callback::result_type dispatch(Source const& source, return cb(src.data(), src.data() + src.size(), cvt); } -#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) && BOOST_FILESYSTEM_VERSION < 4 +#if defined(BOOST_FILESYSTEM_DEPRECATED) && BOOST_FILESYSTEM_VERSION < 4 template< typename Callback > BOOST_FORCEINLINE typename Callback::result_type dispatch(std::vector< char > const& source, Callback cb, const codecvt_type* cvt, range_type_tag) @@ -463,7 +463,7 @@ BOOST_FORCEINLINE typename Callback::result_type dispatch(std::vector< wchar_t > return cb(data, data_end, cvt); } -#endif // !defined(BOOST_FILESYSTEM_NO_DEPRECATED) && BOOST_FILESYSTEM_VERSION < 4 +#endif // defined(BOOST_FILESYSTEM_DEPRECATED) && BOOST_FILESYSTEM_VERSION < 4 // Defined in directory.hpp to avoid circular header dependencies template< typename Callback > diff --git a/include/boost/filesystem/directory.hpp b/include/boost/filesystem/directory.hpp index 8158500..9b50b04 100644 --- a/include/boost/filesystem/directory.hpp +++ b/include/boost/filesystem/directory.hpp @@ -591,14 +591,6 @@ inline bool is_other(directory_entry const& e, system::error_code& ec) noexcept return e.is_other(ec); } -#ifndef BOOST_FILESYSTEM_NO_DEPRECATED -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use is_regular_file() instead") -inline bool is_regular(directory_entry const& e) -{ - return filesystem::is_regular_file(e); -} -#endif - //--------------------------------------------------------------------------------------// // // // directory_iterator helpers // @@ -816,19 +808,6 @@ namespace filesystem { // // //--------------------------------------------------------------------------------------// -#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) -// Deprecated enum, use directory_options instead -enum class symlink_option : unsigned int -{ - none = static_cast< unsigned int >(directory_options::none), - no_recurse = none, // don't follow directory symlinks (default behavior) - recurse = static_cast< unsigned int >(directory_options::follow_directory_symlink), // follow directory symlinks - _detail_no_push = static_cast< unsigned int >(directory_options::_detail_no_push) // internal use only -}; - -BOOST_BITMASK(symlink_option) -#endif // BOOST_FILESYSTEM_NO_DEPRECATED - class recursive_directory_iterator; namespace detail { @@ -892,21 +871,6 @@ public: detail::recursive_directory_iterator_construct(*this, dir_path, static_cast< unsigned int >(opts), &ec); } -#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) - // Deprecated constructors - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use directory_options instead of symlink_option") - recursive_directory_iterator(path const& dir_path, symlink_option opts) - { - detail::recursive_directory_iterator_construct(*this, dir_path, static_cast< unsigned int >(opts), nullptr); - } - - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use directory_options instead of symlink_option") - recursive_directory_iterator(path const& dir_path, symlink_option opts, system::error_code& ec) noexcept - { - detail::recursive_directory_iterator_construct(*this, dir_path, static_cast< unsigned int >(opts), &ec); - } -#endif // BOOST_FILESYSTEM_NO_DEPRECATED - recursive_directory_iterator(recursive_directory_iterator const&) = default; recursive_directory_iterator& operator=(recursive_directory_iterator const&) = default; @@ -939,16 +903,6 @@ public: return (m_imp->m_options & static_cast< unsigned int >(directory_options::_detail_no_push)) == 0u; } -#ifndef BOOST_FILESYSTEM_NO_DEPRECATED - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use recursive_directory_iterator::depth() instead") - int level() const noexcept - { - return depth(); - } - bool no_push_pending() const noexcept { return !recursion_pending(); } - bool no_push_request() const noexcept { return !recursion_pending(); } -#endif - void pop() { detail::recursive_directory_iterator_pop(*this, nullptr); @@ -968,14 +922,6 @@ public: m_imp->m_options &= ~static_cast< unsigned int >(directory_options::_detail_no_push); } -#ifndef BOOST_FILESYSTEM_NO_DEPRECATED - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use recursive_directory_iterator::disable_recursion_pending() instead") - void no_push(bool value = true) noexcept - { - disable_recursion_pending(value); - } -#endif - file_status status() const { BOOST_ASSERT_MSG(!is_end(), "status() on end recursive_directory_iterator"); @@ -1019,11 +965,6 @@ private: boost::intrusive_ptr< detail::recur_dir_itr_imp > m_imp; }; -#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use recursive_directory_iterator instead") -typedef recursive_directory_iterator wrecursive_directory_iterator; -#endif - // enable recursive directory iterator C++11 range-base for statement use ----------// // begin() and end() are only used by a range-based for statement in the context of diff --git a/include/boost/filesystem/file_status.hpp b/include/boost/filesystem/file_status.hpp index 0f21df4..c435c77 100644 --- a/include/boost/filesystem/file_status.hpp +++ b/include/boost/filesystem/file_status.hpp @@ -33,9 +33,6 @@ namespace filesystem { enum file_type { status_error, -#ifndef BOOST_FILESYSTEM_NO_DEPRECATED - status_unknown = status_error, -#endif file_not_found, regular_file, directory_file, @@ -247,14 +244,6 @@ inline BOOST_CONSTEXPR bool is_other(file_status f) noexcept return filesystem::exists(f) && !filesystem::is_regular_file(f) && !filesystem::is_directory(f) && !filesystem::is_symlink(f); } -#ifndef BOOST_FILESYSTEM_NO_DEPRECATED -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use is_regular_file() instead") -inline bool is_regular(file_status f) noexcept -{ - return filesystem::is_regular_file(f); -} -#endif - } // namespace filesystem } // namespace boost diff --git a/include/boost/filesystem/operations.hpp b/include/boost/filesystem/operations.hpp index 1c31803..034b54f 100644 --- a/include/boost/filesystem/operations.hpp +++ b/include/boost/filesystem/operations.hpp @@ -20,12 +20,6 @@ #include
#include -#ifndef BOOST_FILESYSTEM_NO_DEPRECATED -// These includes are left for backward compatibility and should be included directly by users, as needed -#include -#include -#endif - #include #include #include @@ -71,16 +65,6 @@ enum class copy_options : unsigned int BOOST_BITMASK(copy_options) -#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) -// Deprecated enum, use copy_options instead -enum class copy_option : unsigned int -{ - none = static_cast< unsigned int >(copy_options::none), - fail_if_exists = none, - overwrite_if_exists = static_cast< unsigned int >(copy_options::overwrite_existing) -}; -#endif - //--------------------------------------------------------------------------------------// // implementation details // //--------------------------------------------------------------------------------------// @@ -105,10 +89,6 @@ BOOST_FILESYSTEM_DECL path canonical_v4(path const& p, path const& base, system::error_code* ec = nullptr); BOOST_FILESYSTEM_DECL void copy(path const& from, path const& to, unsigned int options, system::error_code* ec = nullptr); -#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) -BOOST_FILESYSTEM_DECL -void copy_directory(path const& from, path const& to, system::error_code* ec = nullptr); -#endif BOOST_FILESYSTEM_DECL bool copy_file(path const& from, path const& to, // See ticket #2925 unsigned int options, system::error_code* ec = nullptr); // see copy_options for options @@ -297,20 +277,6 @@ inline bool is_other(path const& p, system::error_code& ec) noexcept return filesystem::is_other(detail::status(p, &ec)); } -#ifndef BOOST_FILESYSTEM_NO_DEPRECATED -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use is_regular_file() instead") -inline bool is_regular(path const& p) -{ - return filesystem::is_regular_file(p); -} - -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use is_regular_file() instead") -inline bool is_regular(path const& p, system::error_code& ec) noexcept -{ - return filesystem::is_regular_file(p, ec); -} -#endif - inline bool is_empty(path const& p) { return detail::is_empty(p); @@ -388,20 +354,6 @@ inline void copy(path const& from, path const& to, copy_options options, system: detail::copy(from, to, static_cast< unsigned int >(options), &ec); } -#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use create_directory() instead") -inline void copy_directory(path const& from, path const& to) -{ - detail::copy_directory(from, to); -} - -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use create_directory() instead") -inline void copy_directory(path const& from, path const& to, system::error_code& ec) noexcept -{ - detail::copy_directory(from, to, &ec); -} -#endif - inline bool copy_file(path const& from, path const& to) { return detail::copy_file(from, to, static_cast< unsigned int >(copy_options::none)); @@ -423,20 +375,6 @@ inline bool copy_file(path const& from, path const& to, copy_options options, sy return detail::copy_file(from, to, static_cast< unsigned int >(options), &ec); } -#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use copy_options instead of copy_option") -inline bool copy_file(path const& from, path const& to, copy_option options) -{ - return detail::copy_file(from, to, static_cast< unsigned int >(options)); -} - -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use copy_options instead of copy_option") -inline bool copy_file(path const& from, path const& to, copy_option options, system::error_code& ec) noexcept -{ - return detail::copy_file(from, to, static_cast< unsigned int >(options), &ec); -} -#endif // !defined(BOOST_FILESYSTEM_NO_DEPRECATED) - inline void copy_symlink(path const& existing_symlink, path const& new_symlink) { detail::copy_symlink(existing_symlink, new_symlink); @@ -646,14 +584,6 @@ inline space_info space(path const& p, system::error_code& ec) noexcept return detail::space(p, &ec); } -#ifndef BOOST_FILESYSTEM_NO_DEPRECATED -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use is_symlink(symlink_status(path)) instead") -inline bool symbolic_link_exists(path const& p) -{ - return is_symlink(filesystem::symlink_status(p)); -} -#endif - inline path system_complete(path const& p) { return detail::system_complete(p); @@ -776,20 +706,6 @@ using BOOST_FILESYSTEM_VERSION_NAMESPACE::canonical; using BOOST_FILESYSTEM_VERSION_NAMESPACE::equivalent; using BOOST_FILESYSTEM_VERSION_NAMESPACE::weakly_canonical; -#ifndef BOOST_FILESYSTEM_NO_DEPRECATED -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use absolute() instead") -inline path complete(path const& p) -{ - return absolute(p, initial_path()); -} - -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use absolute() instead") -inline path complete(path const& p, path const& base) -{ - return absolute(p, base); -} -#endif - // test helper -----------------------------------------------------------------------// // Not part of the documented interface since false positives are possible; diff --git a/include/boost/filesystem/path.hpp b/include/boost/filesystem/path.hpp index 458db58..cc94467 100644 --- a/include/boost/filesystem/path.hpp +++ b/include/boost/filesystem/path.hpp @@ -1039,44 +1039,6 @@ public: static BOOST_FILESYSTEM_DECL std::locale imbue(std::locale const& loc); static BOOST_FILESYSTEM_DECL codecvt_type const& codecvt(); - // ----- deprecated functions ----- - -#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) - // recently deprecated functions supplied by default - path& normalize(); - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::remove_filename() instead") - path& remove_leaf() { return remove_filename(); } - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::filename() instead") - path leaf() const { return filename(); } - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::parent_path() instead") - path branch_path() const { return parent_path(); } - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::generic_path() instead") - path generic() const { return generic_path(); } - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use !path::empty() instead") - bool has_leaf() const { return !m_pathname.empty(); } - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::has_parent_path() instead") - bool has_branch_path() const { return has_parent_path(); } - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::is_absolute() instead") - bool is_complete() const { return is_absolute(); } -#endif - -#if defined(BOOST_FILESYSTEM_DEPRECATED) - // deprecated functions with enough signature or semantic changes that they are - // not supplied by default - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::string() instead") - std::string file_string() const { return string(); } - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::string() instead") - std::string directory_string() const { return string(); } - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::string() instead") - std::string native_file_string() const { return string(); } - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::string() instead") - std::string native_directory_string() const { return string(); } - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::native() instead") - string_type external_file_string() const { return native(); } - BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::native() instead") - string_type external_directory_string() const { return native(); } -#endif - //--------------------------------------------------------------------------------------// // class path private members // //--------------------------------------------------------------------------------------// @@ -1098,10 +1060,6 @@ BOOST_FILESYSTEM_DECL path const& dot_path(); BOOST_FILESYSTEM_DECL path const& dot_dot_path(); } // namespace detail -#ifndef BOOST_FILESYSTEM_NO_DEPRECATED -typedef path wpath; -#endif - namespace path_detail { //------------------------------------------------------------------------------------// @@ -1584,18 +1542,6 @@ inline bool path::filename_is_dot_dot() const // to deal with "c:.." edge case on Windows when ':' acts as a separator } -#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) - -BOOST_FILESYSTEM_DETAIL_DEPRECATED("Use path::lexically_normal() instead") -BOOST_FORCEINLINE path& path::normalize() -{ - path tmp(lexically_normal()); - m_pathname.swap(tmp.m_pathname); - return *this; -} - -#endif // !defined(BOOST_FILESYSTEM_NO_DEPRECATED) - // The following functions are defined differently, depending on Boost.Filesystem version in use. // To avoid ODR violation, these functions are not defined when the library itself is built. // This makes sure they are not compiled when the library is built, and the only version there is diff --git a/include/boost/filesystem/path_traits.hpp b/include/boost/filesystem/path_traits.hpp deleted file mode 100644 index da693e6..0000000 --- a/include/boost/filesystem/path_traits.hpp +++ /dev/null @@ -1,38 +0,0 @@ -// filesystem path_traits.hpp --------------------------------------------------------// - -// Copyright Beman Dawes 2009 -// Copyright Andrey Semashev 2022 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -#ifndef BOOST_FILESYSTEM_PATH_TRAITS_HPP -#define BOOST_FILESYSTEM_PATH_TRAITS_HPP - -#include - -#if !defined(BOOST_FILESYSTEM_DEPRECATED) && !defined(BOOST_FILESYSTEM_ALLOW_DEPRECATED) -#include -BOOST_HEADER_DEPRECATED("your own implementation") -#endif - -#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) - -#include -#include // must be the last #include - -namespace boost { -namespace filesystem { - -namespace path_traits = boost::filesystem::detail::path_traits; - -} // namespace filesystem -} // namespace boost - -#include - -#endif // !defined(BOOST_FILESYSTEM_NO_DEPRECATED) - -#endif // BOOST_FILESYSTEM_PATH_TRAITS_HPP diff --git a/src/operations.cpp b/src/operations.cpp index 2d6ec70..9347a79 100644 --- a/src/operations.cpp +++ b/src/operations.cpp @@ -3497,53 +3497,6 @@ bool create_directory(path const& p, const path* existing, error_code* ec) return false; } -// Deprecated, to be removed in a future release -BOOST_FILESYSTEM_DECL -void copy_directory(path const& from, path const& to, system::error_code* ec) -{ - if (ec) - ec->clear(); - -#if defined(BOOST_POSIX_API) - -#if defined(BOOST_FILESYSTEM_USE_STATX) - int err; - struct ::statx from_stat; - if (BOOST_UNLIKELY(invoke_statx(AT_FDCWD, from.c_str(), AT_NO_AUTOMOUNT, STATX_TYPE | STATX_MODE, &from_stat) < 0)) - { - fail_errno: - err = errno; - fail: - emit_error(err, from, to, ec, "boost::filesystem::copy_directory"); - return; - } - - if (BOOST_UNLIKELY((from_stat.stx_mask & (STATX_TYPE | STATX_MODE)) != (STATX_TYPE | STATX_MODE))) - { - err = BOOST_ERROR_NOT_SUPPORTED; - goto fail; - } -#else - struct ::stat from_stat; - if (BOOST_UNLIKELY(::stat(from.c_str(), &from_stat) < 0)) - { - fail_errno: - emit_error(errno, from, to, ec, "boost::filesystem::copy_directory"); - return; - } -#endif - - if (BOOST_UNLIKELY(::mkdir(to.c_str(), get_mode(from_stat)) < 0)) - goto fail_errno; - -#else // defined(BOOST_POSIX_API) - - if (BOOST_UNLIKELY(!::CreateDirectoryExW(from.c_str(), to.c_str(), 0))) - emit_error(BOOST_ERRNO, from, to, ec, "boost::filesystem::copy_directory"); - -#endif // defined(BOOST_POSIX_API) -} - BOOST_FILESYSTEM_DECL void create_directory_symlink(path const& to, path const& from, system::error_code* ec) { diff --git a/test/convenience_test.cpp b/test/convenience_test.cpp index 67de427..484c93c 100644 --- a/test/convenience_test.cpp +++ b/test/convenience_test.cpp @@ -19,9 +19,9 @@ #endif #include -#include #include #include +#include #include #include diff --git a/test/deprecated_test.cpp b/test/deprecated_test.cpp index 3b621ad..509660e 100644 --- a/test/deprecated_test.cpp +++ b/test/deprecated_test.cpp @@ -47,125 +47,6 @@ void check(const fs::path& source, const std::string& expected, int line) << "\"" << std::endl; } -void normalize_test() -{ - PATH_CHECK(path("").normalize(), ""); - PATH_CHECK(path("/").normalize(), "/"); - PATH_CHECK(path("//").normalize(), "//"); - PATH_CHECK(path("///").normalize(), "/"); - PATH_CHECK(path("f").normalize(), "f"); - PATH_CHECK(path("foo").normalize(), "foo"); - PATH_CHECK(path("foo/").normalize(), "foo/."); - PATH_CHECK(path("f/").normalize(), "f/."); - PATH_CHECK(path("/foo").normalize(), "/foo"); - PATH_CHECK(path("foo/bar").normalize(), "foo/bar"); - PATH_CHECK(path("..").normalize(), ".."); - PATH_CHECK(path("../..").normalize(), "../.."); - PATH_CHECK(path("/..").normalize(), "/.."); - PATH_CHECK(path("/../..").normalize(), "/../.."); - PATH_CHECK(path("../foo").normalize(), "../foo"); - PATH_CHECK(path("foo/..").normalize(), "."); - PATH_CHECK(path("foo/../").normalize(), "."); - PATH_CHECK((path("foo") / "..").normalize(), "."); - PATH_CHECK(path("foo/...").normalize(), "foo/..."); - PATH_CHECK(path("foo/.../").normalize(), "foo/.../."); - PATH_CHECK(path("foo/..bar").normalize(), "foo/..bar"); - PATH_CHECK(path("../f").normalize(), "../f"); - PATH_CHECK(path("/../f").normalize(), "/../f"); - PATH_CHECK(path("f/..").normalize(), "."); - PATH_CHECK((path("f") / "..").normalize(), "."); - PATH_CHECK(path("foo/../..").normalize(), ".."); - PATH_CHECK(path("foo/../../").normalize(), "../."); - PATH_CHECK(path("foo/../../..").normalize(), "../.."); - PATH_CHECK(path("foo/../../../").normalize(), "../../."); - PATH_CHECK(path("foo/../bar").normalize(), "bar"); - PATH_CHECK(path("foo/../bar/").normalize(), "bar/."); - PATH_CHECK(path("foo/bar/..").normalize(), "foo"); - PATH_CHECK(path("foo/bar/../").normalize(), "foo/."); - PATH_CHECK(path("foo/bar/../..").normalize(), "."); - PATH_CHECK(path("foo/bar/../../").normalize(), "."); - PATH_CHECK(path("foo/bar/../blah").normalize(), "foo/blah"); - PATH_CHECK(path("f/../b").normalize(), "b"); - PATH_CHECK(path("f/b/..").normalize(), "f"); - PATH_CHECK(path("f/b/../").normalize(), "f/."); - PATH_CHECK(path("f/b/../a").normalize(), "f/a"); - PATH_CHECK(path("foo/bar/blah/../..").normalize(), "foo"); - PATH_CHECK(path("foo/bar/blah/../../bletch").normalize(), "foo/bletch"); - PATH_CHECK(path("//net").normalize(), "//net"); - PATH_CHECK(path("//net/").normalize(), "//net/"); - PATH_CHECK(path("//..net").normalize(), "//..net"); - PATH_CHECK(path("//net/..").normalize(), "//net/.."); - PATH_CHECK(path("//net/foo").normalize(), "//net/foo"); - PATH_CHECK(path("//net/foo/").normalize(), "//net/foo/."); - PATH_CHECK(path("//net/foo/..").normalize(), "//net/"); - PATH_CHECK(path("//net/foo/../").normalize(), "//net/."); - - PATH_CHECK(path("/net/foo/bar").normalize(), "/net/foo/bar"); - PATH_CHECK(path("/net/foo/bar/").normalize(), "/net/foo/bar/."); - PATH_CHECK(path("/net/foo/..").normalize(), "/net"); - PATH_CHECK(path("/net/foo/../").normalize(), "/net/."); - - PATH_CHECK(path("//net//foo//bar").normalize(), "//net/foo/bar"); - PATH_CHECK(path("//net//foo//bar//").normalize(), "//net/foo/bar/."); - PATH_CHECK(path("//net//foo//..").normalize(), "//net/"); - PATH_CHECK(path("//net//foo//..//").normalize(), "//net/."); - - PATH_CHECK(path("///net///foo///bar").normalize(), "/net/foo/bar"); - PATH_CHECK(path("///net///foo///bar///").normalize(), "/net/foo/bar/."); - PATH_CHECK(path("///net///foo///..").normalize(), "/net"); - PATH_CHECK(path("///net///foo///..///").normalize(), "/net/."); - - if (platform == "Windows") - { - PATH_CHECK(path("c:..").normalize(), "c:.."); - PATH_CHECK(path("c:foo/..").normalize(), "c:"); - - PATH_CHECK(path("c:foo/../").normalize(), "c:."); - - PATH_CHECK(path("c:/foo/..").normalize(), "c:/"); - PATH_CHECK(path("c:/foo/../").normalize(), "c:/."); - PATH_CHECK(path("c:/..").normalize(), "c:/.."); - PATH_CHECK(path("c:/../").normalize(), "c:/../."); - PATH_CHECK(path("c:/../..").normalize(), "c:/../.."); - PATH_CHECK(path("c:/../../").normalize(), "c:/../../."); - PATH_CHECK(path("c:/../foo").normalize(), "c:/../foo"); - PATH_CHECK(path("c:/../foo/").normalize(), "c:/../foo/."); - PATH_CHECK(path("c:/../../foo").normalize(), "c:/../../foo"); - PATH_CHECK(path("c:/../../foo/").normalize(), "c:/../../foo/."); - PATH_CHECK(path("c:/..foo").normalize(), "c:/..foo"); - } - else // POSIX - { - PATH_CHECK(path("c:..").normalize(), "c:.."); - PATH_CHECK(path("c:foo/..").normalize(), "."); - PATH_CHECK(path("c:foo/../").normalize(), "."); - PATH_CHECK(path("c:/foo/..").normalize(), "c:"); - PATH_CHECK(path("c:/foo/../").normalize(), "c:/."); - PATH_CHECK(path("c:/..").normalize(), "."); - PATH_CHECK(path("c:/../").normalize(), "."); - PATH_CHECK(path("c:/../..").normalize(), ".."); - PATH_CHECK(path("c:/../../").normalize(), "../."); - PATH_CHECK(path("c:/../foo").normalize(), "foo"); - PATH_CHECK(path("c:/../foo/").normalize(), "foo/."); - PATH_CHECK(path("c:/../../foo").normalize(), "../foo"); - PATH_CHECK(path("c:/../../foo/").normalize(), "../foo/."); - PATH_CHECK(path("c:/..foo").normalize(), "c:/..foo"); - } -} - -// misc_test ------------------------------------------------------------------------// - -void misc_test() -{ - fs::path p; - - fs::initial_path< fs::path >(); - fs::initial_path< fs::wpath >(); - - p.file_string(); - p.directory_string(); -} - // path_container_ctor_test ---------------------------------------------------------// void path_container_ctor_test() @@ -188,28 +69,6 @@ void path_container_ctor_test() BOOST_TEST_EQ(xll.native().size(), 7U); } - -// path_rename_test -----------------------------------------------------------------// - -void path_rename_test() -{ - fs::path p("foo/bar/blah"); - - BOOST_TEST_EQ(path("foo/bar/blah").remove_leaf(), "foo/bar"); - BOOST_TEST_EQ(p.leaf(), "blah"); - BOOST_TEST_EQ(p.branch_path(), "foo/bar"); - BOOST_TEST(p.has_leaf()); - BOOST_TEST(p.has_branch_path()); - BOOST_TEST(!p.is_complete()); - - if (platform == "Windows") - { - BOOST_TEST_EQ(path("foo\\bar\\blah").remove_leaf(), "foo\\bar"); - p = "foo\\bar\\blah"; - BOOST_TEST_EQ(p.branch_path(), "foo\\bar"); - } -} - } // unnamed namespace //--------------------------------------------------------------------------------------// @@ -261,54 +120,12 @@ int cpp_main(int /*argc*/, char* /*argv*/[]) de.replace_filename("bar.foo", fs::file_status(), fs::file_status()); BOOST_TEST(de.path() == "bar.foo"); - de.replace_leaf("", fs::file_status(), fs::file_status()); - - //de.leaf(); - //de.string(); - - fs::path ng(" no-way, Jose"); - BOOST_TEST(!fs::is_regular(ng)); // verify deprecated name still works - BOOST_TEST(!fs::symbolic_link_exists("nosuchfileordirectory")); - const fs::path temp_dir(fs::current_path() / ".." / fs::unique_path("deprecated_test-%%%%-%%%%-%%%%")); std::cout << "temp_dir is " << temp_dir.string() << std::endl; fs::create_directory(temp_dir); - misc_test(); path_container_ctor_test(); - path_rename_test(); - normalize_test(); - - BOOST_TEST(fs::path("foo/bar").generic() == fs::path("foo/bar")); - - // extension() tests ---------------------------------------------------------// - - BOOST_TEST(fs::extension("a/b") == ""); - BOOST_TEST(fs::extension("a/b.txt") == ".txt"); - BOOST_TEST(fs::extension("a/b.") == "."); - BOOST_TEST(fs::extension("a.b.c") == ".c"); - BOOST_TEST(fs::extension("a.b.c.") == "."); - BOOST_TEST(fs::extension("") == ""); - BOOST_TEST(fs::extension("a/") == ""); - - // basename() tests ----------------------------------------------------------// - - BOOST_TEST(fs::basename("b") == "b"); - BOOST_TEST(fs::basename("a/b.txt") == "b"); - BOOST_TEST(fs::basename("a/b.") == "b"); - BOOST_TEST(fs::basename("a.b.c") == "a.b"); - BOOST_TEST(fs::basename("a.b.c.") == "a.b.c"); - BOOST_TEST(fs::basename("") == ""); - - // change_extension tests ---------------------------------------------------// - - BOOST_TEST(fs::change_extension("a.txt", ".tex").string() == "a.tex"); - BOOST_TEST(fs::change_extension("a.", ".tex").string() == "a.tex"); - BOOST_TEST(fs::change_extension("a", ".txt").string() == "a.txt"); - BOOST_TEST(fs::change_extension("a.b.txt", ".tex").string() == "a.b.tex"); - // see the rationale in html docs for explanation why this works - BOOST_TEST(fs::change_extension("", ".png").string() == ".png"); std::cout << "post-test removal of " << temp_dir << std::endl; BOOST_TEST(fs::remove_all(temp_dir) != 0);