Skip to content

Commit c3dd47e

Browse files
committed
Add validation when changing recording parent directory and set default if invalid
1 parent 87f8c68 commit c3dd47e

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

Source/UI/ControlPanel.cpp

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,9 +1272,30 @@ void ControlPanel::setSelectedRecordEngine (int index)
12721272

12731273
void ControlPanel::filenameComponentChanged (FilenameComponent* fnComponent)
12741274
{
1275-
for (auto recNode : AccessClass::getProcessorGraph()->getRecordNodes())
1275+
File currentFile = fnComponent->getCurrentFile();
1276+
1277+
if (! currentFile.exists())
12761278
{
1277-
recNode->setDefaultRecordingDirectory (fnComponent->getCurrentFile());
1279+
StringArray fileNames = fnComponent->getRecentlyUsedFilenames();
1280+
fileNames.removeString (currentFile.getFullPathName(), true);
1281+
fnComponent->setCurrentFile (CoreServices::getDefaultUserSaveDirectory(), true, dontSendNotification);
1282+
fnComponent->setRecentlyUsedFilenames (fileNames);
1283+
1284+
if (! isConsoleApp)
1285+
{
1286+
AccessClass::getUIComponent()->showBubbleMessage (fnComponent,
1287+
"The selected recording directory does not exist. "
1288+
"Setting the parent recording directory to the default user save directory.");
1289+
}
1290+
1291+
return;
1292+
}
1293+
else
1294+
{
1295+
for (auto recNode : AccessClass::getProcessorGraph()->getRecordNodes())
1296+
{
1297+
recNode->setDefaultRecordingDirectory (currentFile);
1298+
}
12781299
}
12791300
}
12801301

0 commit comments

Comments
 (0)