1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:07:25 +08:00

Use the oldest user config file available when there happens to be multiple config files available.

This commit is contained in:
Lucas A 2021-02-05 21:19:13 +01:00
parent 383c40b992
commit f6d08f54e6

View File

@ -35,7 +35,11 @@ namespace osu.Game.IO
{ {
var songsDirectoryPath = Path.Combine(BasePath, stable_default_songs_path); var songsDirectoryPath = Path.Combine(BasePath, stable_default_songs_path);
var configFile = GetFiles(".", "osu!.*.cfg").SingleOrDefault(); // 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();
if (configFile == null) if (configFile == null)
return songsDirectoryPath; return songsDirectoryPath;