diff options
| -rw-r--r-- | zencore/filesystem.cpp | 10 | ||||
| -rw-r--r-- | zencore/include/zencore/filesystem.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/zencore/filesystem.cpp b/zencore/filesystem.cpp index 52f02b56a..4456757a6 100644 --- a/zencore/filesystem.cpp +++ b/zencore/filesystem.cpp @@ -728,6 +728,16 @@ ScanFile(std::filesystem::path Path, const uint64_t ChunkSize, std::function<voi return true; } +void +PathToUtf8(const std::filesystem::path& Path, StringBuilderBase& Out) +{ +#if ZEN_PLATFORM_WINDOWS + WideToUtf8(Path.native().c_str(), Out); +#else + Out << Path.c_str(); +#endif +} + std::string PathToUtf8(const std::filesystem::path& Path) { diff --git a/zencore/include/zencore/filesystem.h b/zencore/include/zencore/filesystem.h index e47d53685..113ffd614 100644 --- a/zencore/include/zencore/filesystem.h +++ b/zencore/include/zencore/filesystem.h @@ -56,6 +56,7 @@ struct CopyFileOptions ZENCORE_API bool CopyFile(std::filesystem::path FromPath, std::filesystem::path ToPath, const CopyFileOptions& Options); ZENCORE_API bool SupportsBlockRefCounting(std::filesystem::path Path); +ZENCORE_API void PathToUtf8(const std::filesystem::path& Path, StringBuilderBase& Out); ZENCORE_API std::string PathToUtf8(const std::filesystem::path& Path); extern template class StringBuilderImpl<std::filesystem::path::value_type>; |