aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-11-16 14:26:30 +0100
committerMartin Ridgers <[email protected]>2021-11-16 14:32:21 +0100
commitb1bb51afb4ff6eac0ed65480be2127d3e06cb01a (patch)
treef0137a2d04b0eba72e17df32e8ce736a757eddc1
parentToUtf8() -> PathToUtf8() as the latter is less ambiguous (diff)
downloadzen-b1bb51afb4ff6eac0ed65480be2127d3e06cb01a.tar.xz
zen-b1bb51afb4ff6eac0ed65480be2127d3e06cb01a.zip
Added a PathToUtf8(path, string-buffer) overload
-rw-r--r--zencore/filesystem.cpp10
-rw-r--r--zencore/include/zencore/filesystem.h1
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>;