aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/projectstore/projectstore.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-03-25 22:57:24 +0100
committerGitHub Enterprise <[email protected]>2024-03-25 22:57:24 +0100
commit9fef50ff26e5c9c56e0794947305429f27da17e8 (patch)
treed610ef436b5ded08d62492618a1b80d3ac802f72 /src/zenserver/projectstore/projectstore.cpp
parentadd a limit to the number of times we attempt to finalize (#22) (diff)
downloadzen-9fef50ff26e5c9c56e0794947305429f27da17e8.tar.xz
zen-9fef50ff26e5c9c56e0794947305429f27da17e8.zip
consistent paths encoding (#24)
* Don't encode filesystem path to UTF8 unless stored in compactbinary string * Be consistent where we encode/decode paths to UTF8
Diffstat (limited to 'src/zenserver/projectstore/projectstore.cpp')
-rw-r--r--src/zenserver/projectstore/projectstore.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/zenserver/projectstore/projectstore.cpp b/src/zenserver/projectstore/projectstore.cpp
index e4a39e55f..7af543dbc 100644
--- a/src/zenserver/projectstore/projectstore.cpp
+++ b/src/zenserver/projectstore/projectstore.cpp
@@ -788,7 +788,7 @@ ProjectStore::Oplog::Read()
CbObject Cfg = LoadCompactBinaryObject(Obj);
- m_MarkerPath = Cfg["gcpath"sv].AsString();
+ m_MarkerPath = Cfg["gcpath"sv].AsU8String();
}
else
{
@@ -1529,11 +1529,11 @@ ProjectStore::Project::Read()
{
CbObject Cfg = LoadCompactBinaryObject(Obj);
- Identifier = Cfg["id"sv].AsString();
- RootDir = Cfg["root"sv].AsString();
- ProjectRootDir = Cfg["project"sv].AsString();
- EngineRootDir = Cfg["engine"sv].AsString();
- ProjectFilePath = Cfg["projectfile"sv].AsString();
+ Identifier = std::filesystem::path(Cfg["id"sv].AsU8String()).string();
+ RootDir = std::filesystem::path(Cfg["root"sv].AsU8String()).string();
+ ProjectRootDir = std::filesystem::path(Cfg["project"sv].AsU8String()).string();
+ EngineRootDir = std::filesystem::path(Cfg["engine"sv].AsU8String()).string();
+ ProjectFilePath = std::filesystem::path(Cfg["projectfile"sv].AsU8String()).string();
}
else
{
@@ -1555,9 +1555,9 @@ ProjectStore::Project::Write()
CbObjectWriter Cfg;
Cfg << "id"sv << Identifier;
Cfg << "root"sv << PathToUtf8(RootDir);
- Cfg << "project"sv << ProjectRootDir;
- Cfg << "engine"sv << EngineRootDir;
- Cfg << "projectfile"sv << ProjectFilePath;
+ Cfg << "project"sv << PathToUtf8(ProjectRootDir);
+ Cfg << "engine"sv << PathToUtf8(EngineRootDir);
+ Cfg << "projectfile"sv << PathToUtf8(ProjectFilePath);
Cfg.Save(Mem);
@@ -2374,10 +2374,10 @@ ProjectStore::OpenProject(std::string_view ProjectId)
Ref<ProjectStore::Project>
ProjectStore::NewProject(const std::filesystem::path& BasePath,
std::string_view ProjectId,
- std::string_view RootDir,
- std::string_view EngineRootDir,
- std::string_view ProjectRootDir,
- std::string_view ProjectFilePath)
+ const std::filesystem::path& RootDir,
+ const std::filesystem::path& EngineRootDir,
+ const std::filesystem::path& ProjectRootDir,
+ const std::filesystem::path& ProjectFilePath)
{
ZEN_TRACE_CPU("Store::NewProject");
@@ -2397,11 +2397,11 @@ ProjectStore::NewProject(const std::filesystem::path& BasePath,
}
bool
-ProjectStore::UpdateProject(std::string_view ProjectId,
- std::string_view RootDir,
- std::string_view EngineRootDir,
- std::string_view ProjectRootDir,
- std::string_view ProjectFilePath)
+ProjectStore::UpdateProject(std::string_view ProjectId,
+ const std::filesystem::path& RootDir,
+ const std::filesystem::path& EngineRootDir,
+ const std::filesystem::path& ProjectRootDir,
+ const std::filesystem::path& ProjectFilePath)
{
ZEN_TRACE_CPU("Store::UpdateProject");
@@ -2491,9 +2491,9 @@ ProjectStore::GetProjectsList()
Response.BeginObject();
Response << "Id"sv << Prj.Identifier;
Response << "RootDir"sv << Prj.RootDir.string();
- Response << "ProjectRootDir"sv << Prj.ProjectRootDir;
- Response << "EngineRootDir"sv << Prj.EngineRootDir;
- Response << "ProjectFilePath"sv << Prj.ProjectFilePath;
+ Response << "ProjectRootDir"sv << PathToUtf8(Prj.ProjectRootDir);
+ Response << "EngineRootDir"sv << PathToUtf8(Prj.EngineRootDir);
+ Response << "ProjectFilePath"sv << PathToUtf8(Prj.ProjectFilePath);
Response.EndObject();
});
Response.EndArray();