From c31e335445c1bf0110c8ff930c3e8cb3125a86b3 Mon Sep 17 00:00:00 2001 From: AdAstra-LD <76622070+AdAstra-LD@users.noreply.github.com> Date: Thu, 16 Jun 2022 15:37:25 +0200 Subject: [PATCH] Handling of non-empty dir (Apicula DAE export) --- DS_Map/DSUtils.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/DS_Map/DSUtils.cs b/DS_Map/DSUtils.cs index 6af0562..f46acc3 100644 --- a/DS_Map/DSUtils.cs +++ b/DS_Map/DSUtils.cs @@ -116,6 +116,20 @@ namespace DSPRE { } string outDir = Path.Combine(cofd.FileName, modelName); + + if (Directory.Exists(outDir)) { + if(Directory.GetFiles(outDir).Length > 0) { + DialogResult d = MessageBox.Show($"Directory \"{outDir}\" already exists and is not empty.\nIts contents will be lost.\n\nDo you want to proceed?", "Directory not empty", MessageBoxButtons.YesNo, MessageBoxIcon.Question); + + if (d.Equals(DialogResult.No)) { + return; + } else { + Directory.Delete(outDir, recursive: true); + } + } else { + Directory.Delete(outDir, recursive: true); + } + } string tempNSBMDPath = outDir + "_temp.nsbmd"; if (textureData != null && textureData.Length > 0) {