aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-11-16 14:25:56 +0100
committerMartin Ridgers <[email protected]>2021-11-16 14:32:21 +0100
commit7875efb57617dc7772da4dcad82b1fb6aacf648c (patch)
tree0ab803e6fde2e093e495a91dd030ff2540a06823
parentRenamed operator<<(bool) to AppendBool() to avoid subtle errors (diff)
downloadzen-7875efb57617dc7772da4dcad82b1fb6aacf648c.tar.xz
zen-7875efb57617dc7772da4dcad82b1fb6aacf648c.zip
ToUtf8() -> PathToUtf8() as the latter is less ambiguous
-rw-r--r--zencore/filesystem.cpp4
-rw-r--r--zencore/include/zencore/filesystem.h2
-rw-r--r--zenserver-test/zenserver-test.cpp4
-rw-r--r--zenserver/diag/logging.cpp6
-rw-r--r--zenserver/projectstore.cpp6
-rw-r--r--zenserver/zenserver.cpp2
6 files changed, 12 insertions, 12 deletions
diff --git a/zencore/filesystem.cpp b/zencore/filesystem.cpp
index 3c5ab2026..52f02b56a 100644
--- a/zencore/filesystem.cpp
+++ b/zencore/filesystem.cpp
@@ -729,7 +729,7 @@ ScanFile(std::filesystem::path Path, const uint64_t ChunkSize, std::function<voi
}
std::string
-ToUtf8(const std::filesystem::path& Path)
+PathToUtf8(const std::filesystem::path& Path)
{
#if ZEN_PLATFORM_WINDOWS
return WideToUtf8(Path.native().c_str());
@@ -946,7 +946,7 @@ TEST_CASE("filesystem")
// GetExePath -- this is not a great test as it's so dependent on where the this code gets linked in
path BinPath = GetRunningExecutablePath();
- const bool ExpectedExe = ToUtf8(BinPath.stem().native()).ends_with("-test"sv) || BinPath.stem() == "zenserver";
+ const bool ExpectedExe = PathToUtf8(BinPath.stem().native()).ends_with("-test"sv) || BinPath.stem() == "zenserver";
CHECK(ExpectedExe);
CHECK(is_regular_file(BinPath));
diff --git a/zencore/include/zencore/filesystem.h b/zencore/include/zencore/filesystem.h
index ec857b33c..e47d53685 100644
--- a/zencore/include/zencore/filesystem.h
+++ b/zencore/include/zencore/filesystem.h
@@ -56,7 +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 std::string ToUtf8(const std::filesystem::path& Path);
+ZENCORE_API std::string PathToUtf8(const std::filesystem::path& Path);
extern template class StringBuilderImpl<std::filesystem::path::value_type>;
diff --git a/zenserver-test/zenserver-test.cpp b/zenserver-test/zenserver-test.cpp
index 0934f9553..bc955727a 100644
--- a/zenserver-test/zenserver-test.cpp
+++ b/zenserver-test/zenserver-test.cpp
@@ -2231,7 +2231,7 @@ struct RemoteExecutionRequest
for (const auto& Kv : m_Visit.m_Files)
{
PrepReq.BeginObject();
- PrepReq << "file" << zen::ToUtf8(Kv.first) << "size" << Kv.second.Size << "hash" << Kv.second.Hash;
+ PrepReq << "file" << zen::PathToUtf8(Kv.first) << "size" << Kv.second.Size << "hash" << Kv.second.Hash;
PrepReq.EndObject();
}
PrepReq.EndArray();
@@ -2301,7 +2301,7 @@ private:
zen::IoHash Hash = Ios.GetHash();
auto RelativePath = FullPath.lexically_relative(m_RootPath).native();
- // ZEN_INFO("File: {:32} => {} ({})", zen::ToUtf8(RelativePath), Hash, FileSize);
+ // ZEN_INFO("File: {:32} => {} ({})", zen::PathToUtf8(RelativePath), Hash, FileSize);
FileEntry& Entry = m_Files[RelativePath];
Entry.Hash = Hash;
diff --git a/zenserver/diag/logging.cpp b/zenserver/diag/logging.cpp
index 6a5c4669e..44a0e2ec6 100644
--- a/zenserver/diag/logging.cpp
+++ b/zenserver/diag/logging.cpp
@@ -233,13 +233,13 @@ InitializeLogging(const ZenServerOptions& GlobalOptions)
auto ConsoleSink = std::make_shared<spdlog::sinks::ansicolor_stdout_sink_mt>();
#if 0
- auto FileSink = std::make_shared<spdlog::sinks::daily_file_sink_mt>(zen::ToUtf8(LogPath),
+ auto FileSink = std::make_shared<spdlog::sinks::daily_file_sink_mt>(zen::PathToUtf8(LogPath),
0,
0,
/* truncate */ false,
uint16_t(/* max files */ 14));
#else
- auto FileSink = std::make_shared<spdlog::sinks::rotating_file_sink_mt>(zen::ToUtf8(LogPath),
+ auto FileSink = std::make_shared<spdlog::sinks::rotating_file_sink_mt>(zen::PathToUtf8(LogPath),
/* max size */ 128 * 1024 * 1024,
/* max files */ 16,
/* rotate on open */ true);
@@ -267,7 +267,7 @@ InitializeLogging(const ZenServerOptions& GlobalOptions)
std::filesystem::path HttpLogPath = GlobalOptions.DataDir / "logs/http.log";
- auto HttpSink = std::make_shared<spdlog::sinks::rotating_file_sink_mt>(zen::ToUtf8(HttpLogPath),
+ auto HttpSink = std::make_shared<spdlog::sinks::rotating_file_sink_mt>(zen::PathToUtf8(HttpLogPath),
/* max size */ 128 * 1024 * 1024,
/* max files */ 16,
/* rotate on open */ true);
diff --git a/zenserver/projectstore.cpp b/zenserver/projectstore.cpp
index 899080696..bf2609672 100644
--- a/zenserver/projectstore.cpp
+++ b/zenserver/projectstore.cpp
@@ -117,7 +117,7 @@ struct ProjectStore::OplogStorage : public RefCounted
#if USE_ROCKSDB
{
- std::string RocksdbPath = ToUtf8(m_OplogStoragePath / "ops.rdb");
+ std::string RocksdbPath = PathToUtf8(m_OplogStoragePath / "ops.rdb");
ZEN_DEBUG("opening rocksdb db at '{}'", RocksdbPath);
@@ -629,7 +629,7 @@ ProjectStore::Project::Write()
CbObjectWriter Cfg;
Cfg << "id" << Identifier;
- Cfg << "root" << ToUtf8(RootDir);
+ Cfg << "root" << PathToUtf8(RootDir);
Cfg << "project" << ProjectRootDir;
Cfg << "engine" << EngineRootDir;
@@ -1630,7 +1630,7 @@ HttpProjectService::HttpProjectService(CidStore& Store, ProjectStore* Projects)
const ProjectStore::Project& Prj = *ProjectIt;
CbObjectWriter Response;
- Response << "id" << Prj.Identifier << "root" << ToUtf8(Prj.RootDir);
+ Response << "id" << Prj.Identifier << "root" << PathToUtf8(Prj.RootDir);
Response.BeginArray("oplogs"sv);
Prj.IterateOplogs([&](const ProjectStore::Oplog& I) { Response << "id"sv << I.OplogId(); });
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index 8b5ec79b6..6ee8d1abb 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -794,7 +794,7 @@ ZenWindowsService::Run()
auto MakeLockData = [&] {
CbObjectWriter Cbo;
- Cbo << "pid" << zen::GetCurrentProcessId() << "data" << ToUtf8(GlobalOptions.DataDir) << "port" << GlobalOptions.BasePort << "session_id"
+ Cbo << "pid" << zen::GetCurrentProcessId() << "data" << PathToUtf8(GlobalOptions.DataDir) << "port" << GlobalOptions.BasePort << "session_id"
<< GetSessionId() << "ready" << IsReady;
return Cbo.Save();
};