Replace any potential usage of Environment.CurrentDirectory with a new RuntimeInfo.StartupDirectory

Using `Environment.CurrentDirectory` for storing / reading files is dangerous as the current directory is mutable and can be changed when performing a certain operation (like opening solutions in roslyn type reference builder for example).
This commit is contained in:
Salman Ahmed
2020-05-31 02:18:07 +03:00
parent e64e44ecf9
commit 82fe99cf4a
5 changed files with 17 additions and 16 deletions

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
@ -118,7 +119,7 @@ namespace osu.Game.Tests.Visual
}
}
localStorage = new Lazy<Storage>(() => new NativeStorage($"{GetType().Name}-{Guid.NewGuid()}"));
localStorage = new Lazy<Storage>(() => RuntimeInfo.StartupStorage.GetStorageForDirectory($"{GetType().Name}-{Guid.NewGuid()}"));
}
[Resolved]