1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 12:17:26 +08:00

Use the newest config file available (where the local username matches the filename)

This commit is contained in:
Lucas A 2021-02-08 11:12:25 +01:00
parent f6d08f54e6
commit f0dfa9f8f3

View File

@ -35,11 +35,7 @@ namespace osu.Game.IO
{
var songsDirectoryPath = Path.Combine(BasePath, stable_default_songs_path);
// enumerate the user config files available in case the user migrated their files from another pc / operating system.
var foundConfigFiles = GetFiles(".", "osu!.*.cfg");
// if more than one config file is found, let's use the oldest one (where the username in the filename doesn't match the local username).
var configFile = foundConfigFiles.Count() > 1 ? foundConfigFiles.FirstOrDefault(filename => !filename[5..^4].Contains(Environment.UserName, StringComparison.Ordinal)) : foundConfigFiles.FirstOrDefault();
var configFile = GetFiles(".", $"osu!.{Environment.UserName}.cfg").SingleOrDefault();
if (configFile == null)
return songsDirectoryPath;