WIP: Initial commit for savefile migration #133

Draft
not_a_segfault wants to merge 12 commits from not_a_segfault/PowerTools:dev into dev
Showing only changes of commit bb9fa9f170 - Show all commits

View file

@ -505,6 +505,15 @@ impl ApiMessageHandler {
false false
} }
ApiMessage::LoadSettings(id, name, variant_id, variant_name) => { ApiMessage::LoadSettings(id, name, variant_id, variant_name) => {
/* Migration steps:
1. Modify to the frontend to send the game ID in this message (`id` here is the app
ID).
2. Change game ID to app ID.
3. (Create and) call function to merge OldSettingsJson with existing FileJson, or
use existing `From<OldSettingsJson> for FileJson` if this game doesn't have a
save in the new format yet.
4. Let the rest of the code below work its magic.
*/
let path = format!("{}.ron", id); let path = format!("{}.ron", id);
if let Err(e) = settings.on_unload() { if let Err(e) = settings.on_unload() {
print_errors("LoadSettings on_unload()", e); print_errors("LoadSettings on_unload()", e);