Remove some redundant `fi.Directory?.Exists` checks
This commit is contained in:
parent
af51ca1513
commit
bee07cca7e
|
@ -31,11 +31,7 @@ namespace BizHawk.Client.Common
|
|||
else
|
||||
{
|
||||
var file = new FileInfo($"{saveStatePrefix}.QuickSave{i % 10}.State");
|
||||
if (file.Directory != null && !file.Directory.Exists)
|
||||
{
|
||||
file.Directory.Create();
|
||||
}
|
||||
|
||||
file.Directory?.Create();
|
||||
_slots[i - 1] = file.Exists;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -255,12 +255,7 @@ namespace BizHawk.Client.Common
|
|||
{
|
||||
try
|
||||
{
|
||||
var file = new FileInfo(path);
|
||||
if (file.Directory != null && !file.Directory.Exists)
|
||||
{
|
||||
file.Directory.Create();
|
||||
}
|
||||
|
||||
new FileInfo(path).Directory?.Create();
|
||||
var sb = new StringBuilder();
|
||||
|
||||
foreach (var cheat in _cheatList)
|
||||
|
|
|
@ -1488,11 +1488,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void TakeScreenshot(string path)
|
||||
{
|
||||
var fi = new FileInfo(path);
|
||||
if (fi.Directory != null && !fi.Directory.Exists)
|
||||
{
|
||||
fi.Directory.Create();
|
||||
}
|
||||
|
||||
fi.Directory?.Create();
|
||||
using (var bb = Config.ScreenshotCaptureOsd ? CaptureOSD() : MakeScreenshotImage())
|
||||
{
|
||||
using var img = bb.ToSysdrawingBitmap();
|
||||
|
@ -4383,12 +4379,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
var path = $"{SaveStatePrefix()}.{quickSlotName}.State";
|
||||
|
||||
var file = new FileInfo(path);
|
||||
if (file.Directory != null && !file.Directory.Exists)
|
||||
{
|
||||
file.Directory.Create();
|
||||
}
|
||||
new FileInfo(path).Directory?.Create();
|
||||
|
||||
// Make backup first
|
||||
if (Config.Savestates.MakeBackups)
|
||||
|
@ -4462,12 +4453,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
var path = Config.PathEntries.SaveStateAbsolutePath(Game.System);
|
||||
|
||||
var file = new FileInfo(path);
|
||||
if (file.Directory != null && !file.Directory.Exists)
|
||||
{
|
||||
file.Directory.Create();
|
||||
}
|
||||
new FileInfo(path).Directory?.Create();
|
||||
|
||||
var result = this.ShowFileSaveDialog(
|
||||
fileExt: "State",
|
||||
|
|
|
@ -877,13 +877,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public string GenerateDefaultCheatFilename()
|
||||
{
|
||||
var path = _config.PathEntries.CheatsAbsolutePath(_game.System);
|
||||
|
||||
var f = new FileInfo(path);
|
||||
if (f.Directory != null && !f.Directory.Exists)
|
||||
{
|
||||
f.Directory.Create();
|
||||
}
|
||||
|
||||
new FileInfo(path).Directory?.Create();
|
||||
return Path.Combine(path, $"{_game.FilesystemSafeName()}.cht");
|
||||
}
|
||||
|
||||
|
|
|
@ -426,10 +426,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
var name = Game.FilesystemSafeName();
|
||||
var filename = Path.Combine(Config.PathEntries.LogAbsolutePath(), name) + _extension;
|
||||
LogFile = new FileInfo(filename);
|
||||
if (LogFile.Directory != null && !LogFile.Directory.Exists)
|
||||
{
|
||||
LogFile.Directory.Create();
|
||||
}
|
||||
LogFile.Directory?.Create();
|
||||
|
||||
// never delete, especially from ticking checkboxes
|
||||
// append = false is enough, and even that only happens when actually enabling logging
|
||||
|
|
Loading…
Reference in New Issue