From d4a4d4fa972f47de529af92cc4eadc05086723ff Mon Sep 17 00:00:00 2001 From: Felipe Bellini Date: Fri, 12 Jun 2020 20:37:04 -0400 Subject: [PATCH] Relates to #2 --- ReflectXMLDB/DatabaseHandler.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ReflectXMLDB/DatabaseHandler.cs b/ReflectXMLDB/DatabaseHandler.cs index 5bba3d4..55b0fcb 100644 --- a/ReflectXMLDB/DatabaseHandler.cs +++ b/ReflectXMLDB/DatabaseHandler.cs @@ -870,7 +870,13 @@ public void ExportDatabase(string pathToSave, string filename, string fileExtens //3. Archive this temp folder to the database file string fullFilePath = Path.Combine(pathToSave, filename + fileExtension); - ZipFile.CreateFromDirectory(tempFolder, fullFilePath); + if(File.Exists(fullFilePath)) + { + //If the file already exists, delete and recreate + File.Delete(fullFilePath); + } + + ZipFile.CreateFromDirectory(tempFolder, fullFilePath, CompressionLevel.Optimal, false); //4. Delete temp folder Directory.Delete(tempFolder, true);