diff --git a/.gitignore b/.gitignore index 640ac9e61d8..70a2d357955 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ # Local overrides--you can use this to change the config for your dev environment (like setting up SQL) without worrying about committing it /config/dev_overrides.txt /config/dev_preferences.json +/config/dev_preferences.json.updatebac #Ignore everything in datafolder and subdirectories /data/**/* diff --git a/code/__DEFINES/preferences.dm b/code/__DEFINES/preferences.dm index ff375d5b770..31465051e15 100644 --- a/code/__DEFINES/preferences.dm +++ b/code/__DEFINES/preferences.dm @@ -38,6 +38,8 @@ #define TOGGLES_DEFAULT_CHAT (CHAT_OOC|CHAT_DEAD|CHAT_PRAYER|CHAT_PULLR|CHAT_GHOSTPDA|CHAT_GHOSTRADIO|CHAT_BANKCARD|CHAT_GHOSTLAWS|CHAT_LOGIN_LOGOUT) +/// File path to where we save backups of preference savefiles when updating them. +#define PREFS_BACKUP_PATH(base_path) "[base_path].updatebac" /// File path to the dev preference json file, which is loaded by guests while localhosting. #define DEV_PREFS_PATH "config/dev_preferences.json" diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index 97801af313a..af6d206ccd5 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -200,7 +200,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car var/data_validity_integer = check_savedata_version(savefile.get_entry()) if(load_and_save && IS_DATA_OBSOLETE(data_validity_integer)) //fatal, can't load any data - var/bacpath = "[path].updatebac" //todo: if the savefile version is higher then the server, check the backup, and give the player a prompt to load the backup + var/bacpath = PREFS_BACKUP_PATH(path) //todo: if the savefile version is higher then the server, check the backup, and give the player a prompt to load the backup if (fexists(bacpath)) fdel(bacpath) //only keep 1 version of backup fcopy(savefile.path, bacpath) //byond helpfully lets you use a savefile for the first arg. @@ -235,7 +235,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car //try to fix any outdated data if necessary if(SHOULD_UPDATE_DATA(data_validity_integer)) - var/bacpath = "[path].updatebac" //todo: if the savefile version is higher then the server, check the backup, and give the player a prompt to load the backup + var/bacpath = PREFS_BACKUP_PATH(path) //todo: if the savefile version is higher then the server, check the backup, and give the player a prompt to load the backup if (fexists(bacpath)) fdel(bacpath) //only keep 1 version of backup fcopy(savefile.path, bacpath) //byond helpfully lets you use a savefile for the first arg.