core/database: Autosave databases if the file version changes
To make sure the latest changes are recorded to disk. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
93d1550763
commit
cf4eedb592
|
@ -1,6 +1,7 @@
|
||||||
6.5.0:
|
6.5.0:
|
||||||
- Add a switch to disable GUI tests
|
- Add a switch to disable GUI tests
|
||||||
- Don't save and restore the "Last Played" tracks column width
|
- Don't save and restore the "Last Played" tracks column width
|
||||||
|
- Save databases if they have been upgraded
|
||||||
|
|
||||||
6.5.0-rc:
|
6.5.0-rc:
|
||||||
- Convert to CMake/CTest
|
- Convert to CMake/CTest
|
||||||
|
|
|
@ -113,6 +113,7 @@ void db_autosave(struct database *db)
|
||||||
void db_load(struct database *db)
|
void db_load(struct database *db)
|
||||||
{
|
{
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
|
bool save;
|
||||||
|
|
||||||
if (file_open(&db->db_file, OPEN_READ) == false)
|
if (file_open(&db->db_file, OPEN_READ) == false)
|
||||||
return;
|
return;
|
||||||
|
@ -124,7 +125,11 @@ void db_load(struct database *db)
|
||||||
__dbe_setup(db, i);
|
__dbe_setup(db, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
save = file_version(&db->db_file) != OCARINA_MINOR_VERSION;
|
||||||
file_close(&db->db_file);
|
file_close(&db->db_file);
|
||||||
|
|
||||||
|
if (save)
|
||||||
|
db_autosave(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct db_entry *db_insert(struct database *db, const gchar *key)
|
struct db_entry *db_insert(struct database *db, const gchar *key)
|
||||||
|
|
Loading…
Reference in New Issue