mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 17:32:54 +08:00
Fix skin setting resetting every launch
The reason this was happening was an unfortunate oversight in the migration logic. The code that was attempting to parse the skin settings as `int` was firing regardless of whether a skin migration from EF to realm had already occurred. If it had occurred, the skin setting would contain a GUID rather than an integer, and therefore fail to parse, and therefore implicitly fallback to a EF skin ID of 0 which would be the default skin. Fix by not running the setting migrating logic at all when there are no EF skins to migrate.
This commit is contained in:
parent
79b8cb41f2
commit
4278a320e4
@ -35,6 +35,16 @@ namespace osu.Game.Database
|
||||
|
||||
private void migrateSkins(DatabaseWriteUsage db)
|
||||
{
|
||||
// can be removed 20220530.
|
||||
var existingSkins = db.Context.SkinInfo
|
||||
.Include(s => s.Files)
|
||||
.ThenInclude(f => f.FileInfo)
|
||||
.ToList();
|
||||
|
||||
// previous entries in EF are removed post migration.
|
||||
if (!existingSkins.Any())
|
||||
return;
|
||||
|
||||
var userSkinChoice = config.GetBindable<string>(OsuSetting.Skin);
|
||||
int.TryParse(userSkinChoice.Value, out int userSkinInt);
|
||||
|
||||
@ -49,16 +59,6 @@ namespace osu.Game.Database
|
||||
break;
|
||||
}
|
||||
|
||||
// migrate ruleset settings. can be removed 20220530.
|
||||
var existingSkins = db.Context.SkinInfo
|
||||
.Include(s => s.Files)
|
||||
.ThenInclude(f => f.FileInfo)
|
||||
.ToList();
|
||||
|
||||
// previous entries in EF are removed post migration.
|
||||
if (!existingSkins.Any())
|
||||
return;
|
||||
|
||||
using (var realm = realmContextFactory.CreateContext())
|
||||
using (var transaction = realm.BeginWrite())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user