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
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 osu = loadOsu(host);
var storage = osu.Dependencies.Get<Storage>(); 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)); Assert.That(storage.GetFullPath("."), Is.EqualTo(defaultStorageLocation));
} }
finally 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] [Test]
public void TestCustomDirectory() public void TestCustomDirectory()
{ {
using (var host = new HeadlessGameHost(nameof(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. // need access before the game has constructed its own storage yet.
Storage storage = new DesktopStorage(defaultStorageLocation, host); Storage storage = new DesktopStorage(defaultStorageLocation, host);
@ -84,7 +84,7 @@ namespace osu.Game.Tests.NonVisual
{ {
using (var host = new HeadlessGameHost(nameof(TestSubDirectoryLookup))) 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. // need access before the game has constructed its own storage yet.
Storage storage = new DesktopStorage(defaultStorageLocation, host); 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) // for testing nested files are not ignored (only top level)
host.Storage.GetStorageForDirectory("test-nested").GetStorageForDirectory("cache"); 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)); Assert.That(storage.GetFullPath("."), Is.EqualTo(defaultStorageLocation));

View File

@ -154,7 +154,7 @@ namespace osu.Game.Rulesets
{ {
try 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"))) foreach (string file in files.Where(f => !Path.GetFileName(f).Contains("Tests")))
loadRulesetFromFile(file); 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] [Resolved]