diff --git a/CHANGELIST.md b/CHANGELIST.md
index d22c06cb..8660028e 100644
--- a/CHANGELIST.md
+++ b/CHANGELIST.md
@@ -15,6 +15,7 @@
- Fix trimming of header output
- Use fake filename for Redumper DAT
- Ensure that the full base path is being used
+- Ensure consistency in output file path checking
### 3.2.2 (2024-09-24)
diff --git a/MPF.Processors/CustomOutputFile.cs b/MPF.Processors/CustomOutputFile.cs
index ee6a0e07..4a1b53cd 100644
--- a/MPF.Processors/CustomOutputFile.cs
+++ b/MPF.Processors/CustomOutputFile.cs
@@ -52,18 +52,9 @@ namespace MPF.Processors
_existsFunc = existsFunc;
}
- ///
- /// Indicates if an output file exists in a base directory
- ///
- /// Base directory to check in
- public override bool Exists(string baseDirectory)
+ ///
+ public override bool Exists()
{
- // If the base directory is invalid
- if (string.IsNullOrEmpty(baseDirectory))
- return false;
- if (!Directory.Exists(baseDirectory))
- return false;
-
foreach (string filename in Filenames)
{
// Check for invalid filenames
@@ -72,8 +63,7 @@ namespace MPF.Processors
try
{
- string possiblePath = Path.Combine(baseDirectory, filename);
- if (_existsFunc(possiblePath))
+ if (_existsFunc(filename))
return true;
}
catch { }
diff --git a/MPF.Processors/OutputFile.cs b/MPF.Processors/OutputFile.cs
index 9986846b..a60df3f3 100644
--- a/MPF.Processors/OutputFile.cs
+++ b/MPF.Processors/OutputFile.cs
@@ -192,15 +192,8 @@ namespace MPF.Processors
///
/// Indicates if an output file exists in a base directory
///
- /// Base directory to check in
- public virtual bool Exists(string baseDirectory)
+ public virtual bool Exists()
{
- // If the base directory is invalid
- if (string.IsNullOrEmpty(baseDirectory))
- return false;
- if (!Directory.Exists(baseDirectory))
- return false;
-
foreach (string filename in Filenames)
{
// Check for invalid filenames
@@ -209,8 +202,7 @@ namespace MPF.Processors
try
{
- string possiblePath = Path.Combine(baseDirectory, filename);
- if (File.Exists(possiblePath))
+ if (File.Exists(filename))
return true;
}
catch { }
diff --git a/MPF.Processors/RegexOutputFile.cs b/MPF.Processors/RegexOutputFile.cs
index 68817dcf..58653fd0 100644
--- a/MPF.Processors/RegexOutputFile.cs
+++ b/MPF.Processors/RegexOutputFile.cs
@@ -45,13 +45,10 @@ namespace MPF.Processors
}
///
- public override bool Exists(string baseDirectory)
+ public override bool Exists()
{
- // If the base directory is invalid
- if (string.IsNullOrEmpty(baseDirectory))
- return false;
- if (!Directory.Exists(baseDirectory))
- return false;
+ // Get the base directory for the first path
+ string baseDirectory = Path.GetDirectoryName(Filenames[0]) ?? string.Empty;
// Get list of all files in directory
var directoryFiles = Directory.GetFiles(baseDirectory);