simplify away FileInfo calls

This commit is contained in:
Morilli 2024-05-23 06:04:37 +02:00
parent 5e8cc23f75
commit 955e35b61f
5 changed files with 5 additions and 5 deletions

View File

@ -66,7 +66,7 @@ namespace BizHawk.Client.Common
if (!string.IsNullOrEmpty(filename))
{
filename += $".{_movieSession.Movie.PreferredExtension}";
if (new FileInfo(filename).Exists)
if (File.Exists(filename))
{
LogCallback($"File {filename} already exists, will not overwrite");
return;

View File

@ -41,7 +41,7 @@ namespace BizHawk.Client.Common
const string MSGFMT_PRE_2_3_3 = "Your config file ({0}) is corrupted, or is from an older version of EmuHawk, predating 2.3.3 (this is {1}). It may fail to load.";
const string MSGFMT_PRE_2_5 = "Your config file ({0}) is corrupted, or is from an older version of EmuHawk, predating 2.5 (this is {1}). It may fail to load.";
if (!new FileInfo(filepath).Exists)
if (!File.Exists(filepath))
{
msg = null;
return true;

View File

@ -242,7 +242,7 @@ namespace BizHawk.Client.Common
}
else if (!_cheatList.Any() && !string.IsNullOrWhiteSpace(CurrentFileName))
{
new FileInfo(CurrentFileName).Delete();
File.Delete(CurrentFileName);
_config.Recent.Remove(CurrentFileName);
}
}

View File

@ -591,7 +591,7 @@ namespace BizHawk.Client.EmuHawk
}
string target = Path.Combine(basePath, fi.Name);
if (new FileInfo(target).Exists)
if (File.Exists(target))
{
// compare the files, if they're the same. don't do anything
if (File.ReadAllBytes(target).SequenceEqual(File.ReadAllBytes(f)))

View File

@ -90,7 +90,7 @@ namespace BizHawk.Common
var split1 = SplitArchiveMemberPath(path);
if (split1 != null) (path, autobind) = split1.Value;
FullPathWithoutMember = path;
Exists = _rootExists = !string.IsNullOrEmpty(path) && new FileInfo(path).Exists;
Exists = _rootExists = File.Exists(path);
if (!_rootExists) return;
if (DearchivalMethod != null && allowArchives)