From cd51dc7bc8d5f539184a4308b41c6b5cabc2aaaa Mon Sep 17 00:00:00 2001 From: Christoph Hart <> Date: Tue, 20 Aug 2024 20:09:12 +0200 Subject: [PATCH] - multipage: added warning message when selecting existing directory --- hi_tools/hi_multipage/InputComponents.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/hi_tools/hi_multipage/InputComponents.cpp b/hi_tools/hi_multipage/InputComponents.cpp index bde2fc0f11..c0b0555b69 100644 --- a/hi_tools/hi_multipage/InputComponents.cpp +++ b/hi_tools/hi_multipage/InputComponents.cpp @@ -1436,7 +1436,26 @@ struct BetterFileSelector: public simple_css::FlexboxComponent, FileChooser fc("Select directory", currentFile, wc, true); if(fc.browseForDirectory()) - setCurrentFile(fc.getResult(), sendNotificationAsync); + { + auto dir = fc.getResult(); + + while(dir.getNumberOfChildFiles(File::findFiles) > 0 || dir.containsSubDirectories()) + { + if(NativeMessageBox::showOkCancelBox(MessageBoxIconType::QuestionIcon, "Use existing directory", "The directory you've selected is not empty. Press OK to continue anyway or cancel to choose an empty directory")) + break; + + if(fc.browseForDirectory()) + { + dir = fc.getResult(); + } + else + { + return; + } + } + + setCurrentFile(dir, sendNotificationAsync); + } } else {