simplify away FileInfo calls
This commit is contained in:
parent
5e8cc23f75
commit
955e35b61f
|
@ -66,7 +66,7 @@ namespace BizHawk.Client.Common
|
||||||
if (!string.IsNullOrEmpty(filename))
|
if (!string.IsNullOrEmpty(filename))
|
||||||
{
|
{
|
||||||
filename += $".{_movieSession.Movie.PreferredExtension}";
|
filename += $".{_movieSession.Movie.PreferredExtension}";
|
||||||
if (new FileInfo(filename).Exists)
|
if (File.Exists(filename))
|
||||||
{
|
{
|
||||||
LogCallback($"File {filename} already exists, will not overwrite");
|
LogCallback($"File {filename} already exists, will not overwrite");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -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_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.";
|
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;
|
msg = null;
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -242,7 +242,7 @@ namespace BizHawk.Client.Common
|
||||||
}
|
}
|
||||||
else if (!_cheatList.Any() && !string.IsNullOrWhiteSpace(CurrentFileName))
|
else if (!_cheatList.Any() && !string.IsNullOrWhiteSpace(CurrentFileName))
|
||||||
{
|
{
|
||||||
new FileInfo(CurrentFileName).Delete();
|
File.Delete(CurrentFileName);
|
||||||
_config.Recent.Remove(CurrentFileName);
|
_config.Recent.Remove(CurrentFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -591,7 +591,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
string target = Path.Combine(basePath, fi.Name);
|
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
|
// compare the files, if they're the same. don't do anything
|
||||||
if (File.ReadAllBytes(target).SequenceEqual(File.ReadAllBytes(f)))
|
if (File.ReadAllBytes(target).SequenceEqual(File.ReadAllBytes(f)))
|
||||||
|
|
|
@ -90,7 +90,7 @@ namespace BizHawk.Common
|
||||||
var split1 = SplitArchiveMemberPath(path);
|
var split1 = SplitArchiveMemberPath(path);
|
||||||
if (split1 != null) (path, autobind) = split1.Value;
|
if (split1 != null) (path, autobind) = split1.Value;
|
||||||
FullPathWithoutMember = path;
|
FullPathWithoutMember = path;
|
||||||
Exists = _rootExists = !string.IsNullOrEmpty(path) && new FileInfo(path).Exists;
|
Exists = _rootExists = File.Exists(path);
|
||||||
if (!_rootExists) return;
|
if (!_rootExists) return;
|
||||||
|
|
||||||
if (DearchivalMethod != null && allowArchives)
|
if (DearchivalMethod != null && allowArchives)
|
||||||
|
|
Loading…
Reference in New Issue