mirror of
https://github.com/SabreTools/MPF.git
synced 2026-02-04 05:35:52 +00:00
Perform better path emptiness checks
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
- Fix CleanRip test access
|
||||
- Add tests around XBC helpers
|
||||
- Fix failing XBC test
|
||||
- Perform better path emptiness checks
|
||||
|
||||
### 3.2.4 (2024-11-24)
|
||||
|
||||
|
||||
@@ -821,7 +821,7 @@ namespace MPF.Processors
|
||||
private static CICMMetadataType? GenerateSidecar(string cicmSidecar)
|
||||
{
|
||||
// If the file doesn't exist, we can't get info from it
|
||||
if (!File.Exists(cicmSidecar))
|
||||
if (string.IsNullOrEmpty(cicmSidecar) || !File.Exists(cicmSidecar))
|
||||
return null;
|
||||
|
||||
// Open and read in the XML file
|
||||
@@ -933,7 +933,7 @@ namespace MPF.Processors
|
||||
private static long GetErrorCount(string resume)
|
||||
{
|
||||
// If the file doesn't exist, we can't get info from it
|
||||
if (!File.Exists(resume))
|
||||
if (string.IsNullOrEmpty(resume) || !File.Exists(resume))
|
||||
return -1;
|
||||
|
||||
// Get a total error count for after
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace MPF.Processors
|
||||
internal static Datafile? GenerateCleanripDatafile(string iso, string dumpinfo)
|
||||
{
|
||||
// Get the size from the ISO, if possible
|
||||
long size = iso.Length > 0 && File.Exists(iso)
|
||||
long size = !string.IsNullOrEmpty(iso) && File.Exists(iso)
|
||||
? new FileInfo(iso).Length
|
||||
: -1;
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace MPF.Processors
|
||||
try
|
||||
{
|
||||
// Make sure this file is a dumpinfo
|
||||
if (dumpinfo.Length > 0 && File.Exists(dumpinfo))
|
||||
if (!string.IsNullOrEmpty(dumpinfo) && File.Exists(dumpinfo))
|
||||
{
|
||||
using var sr = File.OpenText(dumpinfo);
|
||||
if (sr.ReadLine()?.Contains("--File Generated by CleanRip") != true)
|
||||
@@ -172,7 +172,7 @@ namespace MPF.Processors
|
||||
internal static string? GetBCA(string bcaPath)
|
||||
{
|
||||
// If the file doesn't exist, we can't get the info
|
||||
if (!File.Exists(bcaPath))
|
||||
if (string.IsNullOrEmpty(bcaPath) || !File.Exists(bcaPath))
|
||||
return null;
|
||||
|
||||
try
|
||||
@@ -215,7 +215,7 @@ namespace MPF.Processors
|
||||
region = null; version = null; name = null; serial = null;
|
||||
|
||||
// If the file doesn't exist, we can't get info from it
|
||||
if (!File.Exists(dumpinfo))
|
||||
if (string.IsNullOrEmpty(dumpinfo) || !File.Exists(dumpinfo))
|
||||
return false;
|
||||
|
||||
try
|
||||
|
||||
@@ -122,10 +122,10 @@ namespace MPF.Processors
|
||||
/// </summary>
|
||||
/// <param name="mainInfo">_mainInfo.txt file location</param>
|
||||
/// <returns>Newline-deliminated PVD if possible, null on error</returns>
|
||||
private static string? GetPVD(string mainInfo)
|
||||
internal static string? GetPVD(string mainInfo)
|
||||
{
|
||||
// If the file doesn't exist, we can't get info from it
|
||||
if (!File.Exists(mainInfo))
|
||||
if (string.IsNullOrEmpty(mainInfo) || !File.Exists(mainInfo))
|
||||
return null;
|
||||
|
||||
try
|
||||
@@ -138,7 +138,7 @@ namespace MPF.Processors
|
||||
while (sr.ReadLine()?.StartsWith("0310") == false) ;
|
||||
|
||||
// Now that we're at the PVD, read each line in and concatenate
|
||||
string pvd = "";
|
||||
string pvd = string.Empty;
|
||||
for (int i = 0; i < 6; i++)
|
||||
pvd += sr.ReadLine() + "\n"; // 320-370
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace MPF.Processors
|
||||
size = -1;
|
||||
|
||||
// If the file doesn't exist, we can't get info from it
|
||||
if (!File.Exists(disc))
|
||||
if (string.IsNullOrEmpty(disc) || !File.Exists(disc))
|
||||
return false;
|
||||
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user