mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 06:52:56 +08:00
Merge pull request #15847 from bdach/tournament-flags-casing-inconsistency
Migrate custom tournament client assets to uppercased directories
This commit is contained in:
commit
bb6f8bd59c
osu.Game.Tournament.Tests/NonVisual
osu.Game.Tournament
Components
IO
Screens/TeamIntro
@ -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");
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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");
|
||||
|
@ -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)
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user