[studio,keel] Make fileChanged emit UUID as well as path, add uuidUrlToUuid

This commit is contained in:
2024-05-22 23:17:28 -05:00
parent 08f958fbac
commit 4a2b1fd743
4 changed files with 15 additions and 7 deletions

View File

@@ -115,7 +115,7 @@ class Project {
// file.
ox::Signal<ox::Error(ox::CRStringView)> fileRecognized;
ox::Signal<ox::Error(ox::CRStringView)> fileDeleted;
ox::Signal<ox::Error(ox::CRStringView)> fileUpdated;
ox::Signal<ox::Error(ox::StringView, ox::UUID)> fileUpdated;
};
@@ -135,7 +135,8 @@ ox::Error Project::writeObj(ox::CRStringView path, T const&obj, ox::ClawFormat f
oxReturnError(writeTypeStore());
}
oxReturnError(keel::setAsset(m_ctx, path, obj));
fileUpdated.emit(path);
oxRequire(uuid, pathToUuid(m_ctx, path));
fileUpdated.emit(path, uuid);
return {};
}

View File

@@ -4,13 +4,16 @@
#pragma once
#include <source_location>
#include <ox/std/error.hpp>
namespace studio {
class NoChangesException: public ox::Exception {
public:
inline NoChangesException(): ox::Exception(OxError(1, "Command makes no changes.")) {}
inline NoChangesException(std::source_location sloc = std::source_location::current()):
ox::Exception(sloc.file_name(), sloc.line(), 1, "Command makes no changes.") {}
};
class UndoCommand {