Hide access to std::filesystem from FilePath.

PiperOrigin-RevId: 766401136
This commit is contained in:
Francis Tsui
2025-06-02 17:07:33 -07:00
committed by Copybara-Service
parent d7a688f415
commit c7cfe3ead4
+7 -4
View File
@@ -17,6 +17,7 @@
#include <filesystem> // NOLINT
#include <string>
#include <utility>
#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;