Skip to content

Commit

Permalink
- multipage: added warning message when selecting existing directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Hart committed Aug 20, 2024
1 parent a1da580 commit cd51dc7
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion hi_tools/hi_multipage/InputComponents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit cd51dc7

Please sign in to comment.