From e990cb1b4d0884dc1e3f9371aa1d55551c5ecf18 Mon Sep 17 00:00:00 2001 From: Dave Glick Date: Fri, 3 Feb 2023 10:03:08 -0500 Subject: [PATCH] Fixed a bug with file cleaning --- RELEASE.md | 4 ++++ src/core/Statiq.Core/Execution/FileCleaner.cs | 15 +++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 5365f61e..e70abb40 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,3 +1,7 @@ +# 1.0.0-beta.67 + +- Fixed a bug that still resulted in file cleaning even when `CleanMode.None` is set (I.e. `--noclean`). + # 1.0.0-beta.66 - Fixed a bug in `ExtractFrontMatter` to ensure front matter is extracted when the delimiter is on the last line of the file. diff --git a/src/core/Statiq.Core/Execution/FileCleaner.cs b/src/core/Statiq.Core/Execution/FileCleaner.cs index 8bdb1fd8..da685271 100644 --- a/src/core/Statiq.Core/Execution/FileCleaner.cs +++ b/src/core/Statiq.Core/Execution/FileCleaner.cs @@ -52,13 +52,16 @@ public virtual async Task CleanBeforeExecutionAsync() } // Clean if we need to - if (CleanMode == CleanMode.Full || _firstExecution) + if (CleanMode != CleanMode.None) { - CleanDirectory(_fileSystem.GetOutputDirectory(), "output"); - } - else if (CleanMode == CleanMode.Self) - { - CleanSelf(); + if (CleanMode == CleanMode.Full || _firstExecution) + { + CleanDirectory(_fileSystem.GetOutputDirectory(), "output"); + } + else if (CleanMode == CleanMode.Self) + { + CleanSelf(); + } } _firstExecution = false;