Autosave named scenes with revision and disk conflict safety

This commit is contained in:
Emil
2026-09-24 02:11:26 +03:00
parent d3217838cb
commit 4a434f7855
10 changed files with 290 additions and 6 deletions
+4 -1
View File
@@ -573,9 +573,12 @@ Json AuthoringService::undo(const std::string& id, std::uint64_t revision) {
Json AuthoringService::redo(const std::string& id, std::uint64_t revision) {
return history(id, revision, true);
}
Json AuthoringService::save(const std::string& id, const std::filesystem::path& relative) {
Json AuthoringService::save(const std::string& id, const std::filesystem::path& relative,
std::optional<std::uint64_t> expected_revision) {
std::lock_guard lock(mutex_);
auto& current = state(id);
if (expected_revision)
check_revision(current.revision, *expected_revision);
const auto selected = relative.empty() ? current.path : relative.lexically_normal();
require(!selected.empty(), "save.path", "Choose a scene path before saving");
const auto path = project_path(root_, selected);