From c7cfe3ead48bf4de497e9e30792f95d597a3c64d Mon Sep 17 00:00:00 2001 From: Francis Tsui Date: Mon, 2 Jun 2025 17:06:23 -0700 Subject: [PATCH] Hide access to std::filesystem from FilePath. PiperOrigin-RevId: 766401136 --- internal/base/file_path.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/base/file_path.h b/internal/base/file_path.h index 09cadbd2..081c92fb 100644 --- a/internal/base/file_path.h +++ b/internal/base/file_path.h @@ -17,6 +17,7 @@ #include // NOLINT #include +#include #include "absl/strings/string_view.h" @@ -32,10 +33,6 @@ class FilePath { FilePath(FilePath&&) = default; FilePath& operator=(FilePath&&) = default; - // TODO: b/418255947 - Remove after migration is complete. - static FilePath FromPath(std::filesystem::path path) { - return FilePath(path.wstring()); - } // Creates a FilePath from a UTF-8 encoded string. // The `path` must be a valid UTF-8 sequence, otherwise the behavior is // undefined. @@ -76,6 +73,12 @@ class FilePath { } private: + static FilePath FromPath(std::filesystem::path path) { + FilePath result; + result.path_ = std::move(path); + return result; + } + std::filesystem::path path_; friend class Files;