1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-15 17:47:18 +08:00

Remove unnecessary use of and remove StartupStorage

This commit is contained in:
Salman Ahmed 2020-05-31 19:49:03 +03:00
parent 82fe99cf4a
commit 2c6887e610
No known key found for this signature in database
GPG Key ID: ED81FD33FD9B58BC
3 changed files with 7 additions and 7 deletions

View File

@ -36,7 +36,7 @@ namespace osu.Game.Tests.NonVisual
var osu = loadOsu(host);
var storage = osu.Dependencies.Get<Storage>();
string defaultStorageLocation = RuntimeInfo.StartupStorage.GetFullPath(Path.Combine("headless", nameof(TestDefaultDirectory)));
string defaultStorageLocation = Path.Combine(RuntimeInfo.StartupDirectory, "headless", nameof(TestDefaultDirectory));
Assert.That(storage.GetFullPath("."), Is.EqualTo(defaultStorageLocation));
}
finally
@ -46,14 +46,14 @@ namespace osu.Game.Tests.NonVisual
}
}
private string customPath { get; } = RuntimeInfo.StartupStorage.GetFullPath("custom-path");
private string customPath => Path.Combine(RuntimeInfo.StartupDirectory, "custom-path");
[Test]
public void TestCustomDirectory()
{
using (var host = new HeadlessGameHost(nameof(TestCustomDirectory)))
{
string defaultStorageLocation = RuntimeInfo.StartupStorage.GetFullPath(Path.Combine("headless", nameof(TestCustomDirectory)));
string defaultStorageLocation = Path.Combine(RuntimeInfo.StartupDirectory, "headless", nameof(TestCustomDirectory));
// need access before the game has constructed its own storage yet.
Storage storage = new DesktopStorage(defaultStorageLocation, host);
@ -84,7 +84,7 @@ namespace osu.Game.Tests.NonVisual
{
using (var host = new HeadlessGameHost(nameof(TestSubDirectoryLookup)))
{
string defaultStorageLocation = RuntimeInfo.StartupStorage.GetFullPath(Path.Combine("headless", nameof(TestSubDirectoryLookup)));
string defaultStorageLocation = Path.Combine(RuntimeInfo.StartupDirectory, "headless", nameof(TestSubDirectoryLookup));
// need access before the game has constructed its own storage yet.
Storage storage = new DesktopStorage(defaultStorageLocation, host);
@ -136,7 +136,7 @@ namespace osu.Game.Tests.NonVisual
// for testing nested files are not ignored (only top level)
host.Storage.GetStorageForDirectory("test-nested").GetStorageForDirectory("cache");
string defaultStorageLocation = RuntimeInfo.StartupStorage.GetFullPath(Path.Combine("headless", nameof(TestMigration)));
string defaultStorageLocation = Path.Combine(RuntimeInfo.StartupDirectory, "headless", nameof(TestMigration));
Assert.That(storage.GetFullPath("."), Is.EqualTo(defaultStorageLocation));

View File

@ -154,7 +154,7 @@ namespace osu.Game.Rulesets
{
try
{
var files = RuntimeInfo.StartupStorage.GetFiles($"{ruleset_library_prefix}.*.dll");
var files = Directory.GetFiles(Path.Combine(RuntimeInfo.StartupDirectory, $"{ruleset_library_prefix}.*.dll"));
foreach (string file in files.Where(f => !Path.GetFileName(f).Contains("Tests")))
loadRulesetFromFile(file);

View File

@ -119,7 +119,7 @@ namespace osu.Game.Tests.Visual
}
}
localStorage = new Lazy<Storage>(() => RuntimeInfo.StartupStorage.GetStorageForDirectory($"{GetType().Name}-{Guid.NewGuid()}"));
localStorage = new Lazy<Storage>(() => new NativeStorage(Path.Combine(RuntimeInfo.StartupDirectory, $"{GetType().Name}-{Guid.NewGuid()}")));
}
[Resolved]