diff --git a/SabreTools.Library/DatFiles/DatStats.cs b/SabreTools.Library/DatFiles/DatStats.cs index 51604f6f..06850414 100644 --- a/SabreTools.Library/DatFiles/DatStats.cs +++ b/SabreTools.Library/DatFiles/DatStats.cs @@ -426,7 +426,7 @@ namespace SabreTools.Library.DatFiles outDir = DirectoryExtensions.Ensure(outDir); // Get the dictionary of desired output report names - Dictionary outputs = DatStats.CreateOutStatsNames(outDir, statDatFormat, reportName); + Dictionary outputs = CreateOutStatsNames(outDir, statDatFormat, reportName); // Make sure we have all files and then order them List files = DirectoryExtensions.GetFilesOnly(inputs); @@ -551,8 +551,7 @@ Please check the log folder if the stats scrolled offscreen", false); outDir += Path.DirectorySeparatorChar; // For each output format, get the appropriate stream writer - if (statDatFormat.HasFlag(StatReportFormat.None)) - output.Add(StatReportFormat.None, CreateOutStatsNamesHelper(outDir, ".null", reportName, overwrite)); + output.Add(StatReportFormat.None, CreateOutStatsNamesHelper(outDir, ".null", reportName, overwrite)); if (statDatFormat.HasFlag(StatReportFormat.Textfile)) output.Add(StatReportFormat.Textfile, CreateOutStatsNamesHelper(outDir, ".txt", reportName, overwrite)); diff --git a/SabreTools.Library/Reports/BaseReport.cs b/SabreTools.Library/Reports/BaseReport.cs index 780fb97a..e1cbb780 100644 --- a/SabreTools.Library/Reports/BaseReport.cs +++ b/SabreTools.Library/Reports/BaseReport.cs @@ -29,7 +29,10 @@ namespace SabreTools.Library.Reports /// True if nodumps should be included in output, false otherwise public BaseReport(string filename, bool baddumpCol = false, bool nodumpCol = false) { - _writer = new StreamWriter(FileExtensions.TryCreate(filename)); + var fs = FileExtensions.TryCreate(filename); + if (fs != null) + _writer = new StreamWriter(fs); + _baddumpCol = baddumpCol; _nodumpCol = nodumpCol; } diff --git a/SabreTools/SabreTools.Help.cs b/SabreTools/SabreTools.Help.cs index 25b95a79..abdbbd19 100644 --- a/SabreTools/SabreTools.Help.cs +++ b/SabreTools/SabreTools.Help.cs @@ -3321,10 +3321,22 @@ The stats that are outputted are as follows: public override void ProcessFeatures(Dictionary features) { + string filename = GetDatHeader(features).FileName; + string outputDir = GetString(features, OutputDirStringValue); + if (Path.GetFileName(filename) != filename) + { + if (string.IsNullOrWhiteSpace(outputDir)) + outputDir = Path.GetDirectoryName(filename); + else + outputDir = Path.Combine(outputDir, Path.GetDirectoryName(filename)); + + filename = Path.GetFileName(filename); + } + DatStats.OutputStats( Inputs, - GetDatHeader(features).FileName, - GetString(features, OutputDirStringValue), + filename, + outputDir, GetBoolean(features, IndividualValue), GetBoolean(features, BaddumpColumnValue), GetBoolean(features, NodumpColumnValue),