mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-30 23:59:41 +02:00
Bug 2326 - Export settings from one effect can be attempted to be imported into another effect - silent fail, with no error message
This commit is contained in:
parent
3545097fe9
commit
64811e49f9
@ -665,6 +665,7 @@ void Effect::ExportPresets()
|
||||
{
|
||||
wxString params;
|
||||
GetAutomationParameters(params);
|
||||
params = GetSymbol().Internal() + ":" + params;
|
||||
|
||||
wxFileName path;
|
||||
|
||||
@ -740,6 +741,27 @@ void Effect::ImportPresets()
|
||||
wxFFile f(path.GetFullPath());
|
||||
if (f.IsOpened()) {
|
||||
if (f.ReadAll(¶ms)) {
|
||||
wxString ident = params.BeforeFirst(':');
|
||||
params = params.AfterFirst(':');
|
||||
if (ident != GetSymbol().Internal()) {
|
||||
// effect identifiers are a sensible length!
|
||||
// must also have some params.
|
||||
if ((params.Length() < 2 ) || (ident.Length() < 2) || (ident.Length() > 30))
|
||||
{
|
||||
Effect::MessageBox(
|
||||
/* i18n-hint %s will be replaced by a file name */
|
||||
XO("%s: Was not a valid presets file.\n")
|
||||
.Format(path.GetFullName()));
|
||||
}
|
||||
else
|
||||
{
|
||||
Effect::MessageBox(
|
||||
/* i18n-hint %s will be replaced by a file name */
|
||||
XO("%s: Was not for this effect.\n")
|
||||
.Format(path.GetFullName()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
SetAutomationParameters(params);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user