[core] Avoid unnecessary disk writes when assets didn't change

This commit is contained in:
derrod 2021-12-29 20:29:07 +01:00
parent 6fb6bb14a4
commit 2adc0b1a3e

View file

@ -335,7 +335,7 @@ class LegendaryCore:
return []
if self.lgd.assets:
assets = self.lgd.assets
assets = self.lgd.assets.copy()
else:
assets = dict()
@ -346,7 +346,9 @@ class LegendaryCore:
]
})
self.lgd.assets = assets
# only save (and write to disk) if there were changes
if self.lgd.assets != assets:
self.lgd.assets = assets
return self.lgd.assets[platform]