@@ -44,16 +44,18 @@ BC_PUSH_WARNING(NO_THROW_IN_NOEXCEPT)
4444
4545inline path trim (const path& value) NOEXCEPT
4646{
47+ static const string_list trims{ " /" , " \\ " , " \x20 " };
48+
4749 // Trailing slash may cause successful create_directories returning false.
48- return system:: trim_right_copy (value. string ( ), { " / " , " \\ " , " \x20 " } );
50+ return to_path ( trim_right_copy (from_path (value ), trims) );
4951}
5052
5153// We don't use ec because it gets set (not found) when false, but no way to
5254// differentiate from false with failure code (and never a code on success).
5355bool is_directory (const path& directory) NOEXCEPT
5456{
5557 code ec{ system::error::errorno_t ::no_error };
56- return std::filesystem::is_directory (system::to_extended_path (directory), ec);
58+ return std::filesystem::is_directory (system::extended_path (directory), ec);
5759}
5860
5961bool clear_directory (const path& directory) NOEXCEPT
@@ -64,7 +66,7 @@ bool clear_directory(const path& directory) NOEXCEPT
6466code clear_directory_ex (const path& directory) NOEXCEPT
6567{
6668 code ec{ system::error::errorno_t ::no_error };
67- const auto path = system::to_extended_path (directory);
69+ const auto path = system::extended_path (directory);
6870 std::filesystem::remove_all (path, ec);
6971 if (ec) return ec;
7072 std::filesystem::create_directories (path, ec);
@@ -79,7 +81,7 @@ bool create_directory(const path& directory) NOEXCEPT
7981code create_directory_ex (const path& directory) NOEXCEPT
8082{
8183 code ec{ system::error::errorno_t ::no_error };
82- const auto path = system::to_extended_path (trim (directory));
84+ const auto path = system::extended_path (trim (directory));
8385 const auto created = std::filesystem::create_directories (path, ec);
8486 if (ec || created) return ec;
8587 return system::error::errorno_t ::is_a_directory;
@@ -182,7 +184,7 @@ bool remove(const path& name) NOEXCEPT
182184code remove_ex (const path& name) NOEXCEPT
183185{
184186 code ec{ system::error::errorno_t ::no_error };
185- std::filesystem::remove (system::to_extended_path (name), ec);
187+ std::filesystem::remove (system::extended_path (name), ec);
186188 return ec;
187189}
188190
@@ -196,8 +198,8 @@ bool rename(const path& from, const path& to) NOEXCEPT
196198code rename_ex (const path& from, const path& to) NOEXCEPT
197199{
198200 code ec{ system::error::errorno_t ::no_error };
199- std::filesystem::rename (system::to_extended_path (from),
200- system::to_extended_path (to), ec);
201+ std::filesystem::rename (system::extended_path (from),
202+ system::extended_path (to), ec);
201203
202204 return ec;
203205}
@@ -212,8 +214,8 @@ bool copy(const path& from, const path& to) NOEXCEPT
212214code copy_ex (const path& from, const path& to) NOEXCEPT
213215{
214216 code ec{ system::error::errorno_t ::no_error };
215- std::filesystem::copy_file (system::to_extended_path (from),
216- system::to_extended_path (to), ec);
217+ std::filesystem::copy_file (system::extended_path (from),
218+ system::extended_path (to), ec);
217219
218220 return ec;
219221}
@@ -234,8 +236,8 @@ code copy_directory_ex(const path& from, const path& to) NOEXCEPT
234236 return system::error::errorno_t ::not_a_directory;
235237
236238 code ec{ system::error::errorno_t ::no_error };
237- std::filesystem::copy (system::to_extended_path (from),
238- system::to_extended_path (to), ec);
239+ std::filesystem::copy (system::extended_path (from),
240+ system::extended_path (to), ec);
239241
240242 return ec;
241243}
@@ -250,7 +252,7 @@ code copy_directory_ex(const path& from, const path& to) NOEXCEPT
250252
251253int open (const path& filename, bool MSC_OR_NOAPPLE (random)) NOEXCEPT
252254{
253- const auto path = system::to_extended_path (filename);
255+ const auto path = system::extended_path (filename);
254256 int file_descriptor{};
255257
256258#if defined(HAVE_MSC)
@@ -371,7 +373,7 @@ code size_ex(size_t& out, const std::filesystem::path& filename) NOEXCEPT
371373{
372374 code ec{ system::error::errorno_t ::no_error };
373375 const auto size = std::filesystem::file_size (
374- to_extended_path (filename), ec);
376+ system::extended_path (filename), ec);
375377
376378 if (ec) return ec;
377379 if (is_limited<size_t >(size))
@@ -389,7 +391,8 @@ bool space(size_t& out, const path& filename) NOEXCEPT
389391code space_ex (size_t & out, const path& filename) NOEXCEPT
390392{
391393 code ec{ system::error::errorno_t ::no_error };
392- const auto space = std::filesystem::space (to_extended_path (filename), ec);
394+ const auto space = std::filesystem::space (
395+ system::extended_path (filename), ec);
393396 if (ec) return ec;
394397 if (is_limited<size_t >(space.available ))
395398 return system::error::errorno_t ::value_too_large;
0 commit comments