1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 06:52:56 +08:00

Merge pull request from bdach/tournament-flags-casing-inconsistency

Migrate custom tournament client assets to uppercased directories
This commit is contained in:
Dean Herbert 2021-11-29 13:07:25 +09:00 committed by GitHub
commit bb6f8bd59c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 9 deletions
osu.Game.Tournament.Tests/NonVisual
osu.Game.Tournament

View File

@ -87,9 +87,9 @@ namespace osu.Game.Tournament.Tests.NonVisual
// Recreate the old setup that uses "tournament" as the base path.
string oldPath = Path.Combine(osuRoot, "tournament");
string videosPath = Path.Combine(oldPath, "videos");
string modsPath = Path.Combine(oldPath, "mods");
string flagsPath = Path.Combine(oldPath, "flags");
string videosPath = Path.Combine(oldPath, "Videos");
string modsPath = Path.Combine(oldPath, "Mods");
string flagsPath = Path.Combine(oldPath, "Flags");
Directory.CreateDirectory(videosPath);
Directory.CreateDirectory(modsPath);
@ -123,9 +123,9 @@ namespace osu.Game.Tournament.Tests.NonVisual
string migratedPath = Path.Combine(host.Storage.GetFullPath("."), "tournaments", "default");
videosPath = Path.Combine(migratedPath, "videos");
modsPath = Path.Combine(migratedPath, "mods");
flagsPath = Path.Combine(migratedPath, "flags");
videosPath = Path.Combine(migratedPath, "Videos");
modsPath = Path.Combine(migratedPath, "Mods");
flagsPath = Path.Combine(migratedPath, "Flags");
videoFile = Path.Combine(videosPath, "video.mp4");
modFile = Path.Combine(modsPath, "mod.png");

View File

@ -31,7 +31,7 @@ namespace osu.Game.Tournament.Components
[BackgroundDependencyLoader]
private void load(TextureStore textures, LadderInfo ladderInfo)
{
var customTexture = textures.Get($"mods/{modAcronym}");
var customTexture = textures.Get($"Mods/{modAcronym}");
if (customTexture != null)
{

View File

@ -51,6 +51,23 @@ namespace osu.Game.Tournament.IO
Logger.Log("Changing tournament storage: " + GetFullPath(string.Empty));
}
protected override void ChangeTargetStorage(Storage newStorage)
{
// due to an unfortunate oversight, on OSes that are sensitive to pathname casing
// the custom flags directory needed to be named `Flags` (uppercase),
// while custom mods and videos directories needed to be named `mods` and `videos` respectively (lowercase).
// to unify handling to uppercase, move any non-compliant directories automatically for the user to migrate.
// can be removed 20220528
if (newStorage.ExistsDirectory("flags"))
AttemptOperation(() => Directory.Move(newStorage.GetFullPath("flags"), newStorage.GetFullPath("Flags")));
if (newStorage.ExistsDirectory("mods"))
AttemptOperation(() => Directory.Move(newStorage.GetFullPath("mods"), newStorage.GetFullPath("Mods")));
if (newStorage.ExistsDirectory("videos"))
AttemptOperation(() => Directory.Move(newStorage.GetFullPath("videos"), newStorage.GetFullPath("Videos")));
base.ChangeTargetStorage(newStorage);
}
public IEnumerable<string> ListTournaments() => AllTournaments.GetDirectories(string.Empty);
public override void Migrate(Storage newStorage)

View File

@ -9,7 +9,7 @@ namespace osu.Game.Tournament.IO
public class TournamentVideoResourceStore : NamespacedResourceStore<byte[]>
{
public TournamentVideoResourceStore(Storage storage)
: base(new StorageBackedResourceStore(storage), "videos")
: base(new StorageBackedResourceStore(storage), "Videos")
{
AddExtension("m4v");
AddExtension("avi");

View File

@ -197,7 +197,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
{
row.Add(new Sprite
{
Texture = textures.Get($"mods/{mods.ToLower()}"),
Texture = textures.Get($"Mods/{mods.ToLower()}"),
Scale = new Vector2(0.5f)
});
}