Include the version number in the uid of the HttpSynchronization (closes #2081)

This commit is contained in:
Alexander Bock
2022-05-06 00:53:56 -07:00
parent 2816ad4d8d
commit 9715d22af0
7 changed files with 18 additions and 21 deletions

View File

@@ -495,14 +495,13 @@ void AssetManager::setUpAssetLuaTable(Asset* asset) {
Asset* thisAsset = ghoul::lua::userData<Asset>(L, 2);
ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::syncedResourceLua");
ghoul::Dictionary d = ghoul::lua::value<ghoul::Dictionary>(L);
std::string uid = ResourceSynchronization::generateUid(d);
std::unique_ptr<ResourceSynchronization> s =
ResourceSynchronization::createFromDictionary(d);
std::string uid = d.value<std::string>("Type") + "/" + s->generateUid();
SyncItem* syncItem = nullptr;
auto it = manager->_synchronizations.find(uid);
if (it == manager->_synchronizations.end()) {
std::unique_ptr<ResourceSynchronization> s =
ResourceSynchronization::createFromDictionary(d);
auto si = std::make_unique<SyncItem>();
si->synchronization = std::move(s);
si->assets.push_back(thisAsset);

View File

@@ -68,11 +68,6 @@ std::unique_ptr<ResourceSynchronization> ResourceSynchronization::createFromDict
return std::unique_ptr<ResourceSynchronization>(sync);
}
std::string ResourceSynchronization::generateUid(const ghoul::Dictionary& dictionary) {
const Parameters p = codegen::bake<Parameters>(dictionary);
return fmt::format("{}/{}", p.type, p.identifier);
}
ResourceSynchronization::ResourceSynchronization(
std::filesystem::path synchronizationRoot)
: _synchronizationRoot(std::move(synchronizationRoot))