mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Fix blank DAT writing
This commit is contained in:
@@ -3405,6 +3405,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <returns>True if the DAT was written correctly, false otherwise</returns>
|
/// <returns>True if the DAT was written correctly, false otherwise</returns>
|
||||||
public bool Write(string outDir, bool norename = true, bool stats = false, bool ignoreblanks = false, bool overwrite = true)
|
public bool Write(string outDir, bool norename = true, bool stats = false, bool ignoreblanks = false, bool overwrite = true)
|
||||||
{
|
{
|
||||||
|
// Force a statistics recheck, just in case
|
||||||
|
Items.RecalculateStats();
|
||||||
|
|
||||||
// If there's nothing there, abort
|
// If there's nothing there, abort
|
||||||
if (Items.TotalCount == 0)
|
if (Items.TotalCount == 0)
|
||||||
{
|
{
|
||||||
@@ -3412,6 +3415,20 @@ namespace SabreTools.Library.DatFiles
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get a count of all removed items
|
||||||
|
long removed = 0;
|
||||||
|
foreach (string key in Items.Keys)
|
||||||
|
{
|
||||||
|
removed += Items[key].Count(i => i.Remove);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If every item is removed, abort
|
||||||
|
if (Items.TotalCount == removed)
|
||||||
|
{
|
||||||
|
Globals.Logger.User("There were no items to write out!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure the output directory is set and created
|
// Ensure the output directory is set and created
|
||||||
outDir = DirectoryExtensions.Ensure(outDir, create: true);
|
outDir = DirectoryExtensions.Ensure(outDir, create: true);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user