From 12dcf907ee51cebf3aec25fa8cd3e52989103277 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 19 Apr 2024 19:30:56 -0500 Subject: [PATCH] Delete export folder if it exists already --- .../Services/Profile/Exporter/ProfileExporter.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Synthesis.Bethesda.GUI/Services/Profile/Exporter/ProfileExporter.cs b/Synthesis.Bethesda.GUI/Services/Profile/Exporter/ProfileExporter.cs index b4b0a5c1..bcad8e9e 100644 --- a/Synthesis.Bethesda.GUI/Services/Profile/Exporter/ProfileExporter.cs +++ b/Synthesis.Bethesda.GUI/Services/Profile/Exporter/ProfileExporter.cs @@ -50,8 +50,15 @@ public void Export(string id) gitPatcher.AutoUpdateToBranchTip = false; gitPatcher.LatestTag = false; } - var subDir = "Export"; - Directory.CreateDirectory(subDir); + DirectoryPath subDir = "Export"; + if (subDir.Exists) + { + subDir.DeleteEntireFolder(deleteFolderItself: false); + } + else + { + Directory.CreateDirectory(subDir); + } File.WriteAllText( Path.Combine(subDir, PipelinePaths.Path), JsonConvert.SerializeObject(pipeSettings, Formatting.Indented, Execution.Constants.JsonSettings));