Closed Gemba closed 5 months ago
Thanks. I apologize, but I won't be able to look into this in the coming weeks for professional commitments, so don't read too much into the lack of response.
I'm wondering, is this in a situation where metadata saving on exit is off, or does it happen all the time? Even though it is not a frequent use case, I am very much under the impression that this was working when it was implemented for my setup at the time, though there might have been cases that clearly didn't work. I likely didn't test without saving on exit.
Just curious. Thanks for putting this together!
There is no rush to address this.
I found out it only happens in the main/head, but not in the version 2.11.2.
From a cursory look, I assume it is because the sysdata.isPopulated
is no longer set true in the main/head branch when the file for the new collection does not exist (CollectionSystemManager::populateCustomCollection()
). But I did not follow it into all details. However, if a collection is not marked populated, it is later not considered for storing any changes.
In master/head it can therefore be reproduced regardless of the setting for the metadata save.
The change makes the creation of a new collection more robust (not depending on the position of sysdata.isPopulated = true;
line.
There is a workaround available: touch
the new collection file on the filesystem (custom-<collectionname>.cfg
in ~/.emulationstation/collections
), restart ES, enable the Collection in the menu and then select add/remove games to this collection when in the collection system view from the menu.
Oh my, thanks for the detailed report. I suppose I must have broken it in one of the recent changes of the collections handling - likely the random collections. Thanks for catching that.
Sorry for the delay. All looks good. Just wondering if we can't stick to writing the files in the CollectionSystemManager class rather than having the same logic in the GuiCollectionSystemsOptions class.
Thanks!
Gently pinging this in case there's still interest in merging this. Happy Monday!
Nvm. Thanks for your patience, also on my side life happens.
You are right it is almost the same code. Leave it with me for a few days, I will rework it a bit and have it put into saveCustomCollection()
.
No worries whatsoever - just wanted to make sure this wasn't lost because of my lack of response.
Take your time - I'll also be off for the better part of the coming few months, so it's alright.
Have a great week!
I spared some time and keep the file create logic in the saveCustomCollection()
.
I used an enum class for the different flags a collection data set can have (as otherwise it would have been another boolean value in the method, plus the first one had a default value). The enum class is more verbose but also is more precisse as boolean flags IMHO.
I have put everywhere toUpper()
for the collection name in the toasts (Gui Popups), it was missing on setEditMode()
.
Review whenever you want/can. I will watch this space to followup.
Great week also for you!
Thanks. All looks good!
Would you comment the enum for the meaning of each value, for future reference? The "Keep in Index" in particular isn't quite clear, so might as well add for all in case someone else looks into this code in the future :)
Makes sense, updated.
Thanks.
Fixes the bug in this scenario:
Result
The custom 'xyz' collection is not created, or if it was a theme based custom collection it is no longer present on the carousel.
Expected result
After restart/reboot, the new collection is still available/present in ES and contains the games added before.
Additional Notes
Hope you can reconstruct the issue. Any Qs, please let me know.