Fix nullability warnings in PathExtensions

Definitely not happy with any of this
This commit is contained in:
YoshiRulz 2020-03-19 15:23:01 +10:00
parent 8ae01f2f42
commit f022954554
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
1 changed files with 3 additions and 1 deletions

View File

@ -78,6 +78,7 @@ namespace BizHawk.Common.PathExtensions
// zero 06-nov-2015 - regarding the below, i changed my mind. for libretro i want subdirectories here.
var filesystemDir = Path.GetDirectoryName(filesystemSafeName);
if (string.IsNullOrEmpty(filesystemDir)) throw new Exception();
filesystemSafeName = Path.GetFileName(filesystemSafeName);
filesystemSafeName = filesystemSafeName.RemoveInvalidFileSystemChars();
@ -114,7 +115,8 @@ namespace BizHawk.Common.PathExtensions
{
public static string GetExeDirectoryAbsolute()
{
var path = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
var path = Path.GetDirectoryName(Assembly.GetEntryAssembly()?.Location);
if (string.IsNullOrEmpty(path)) throw new Exception();
if (path.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
path = path.Remove(path.Length - 1, 1);