mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-17 08:40:27 +02:00
Bug2325: Don't hang exporting effect presets twice...
... or, what I saw in my Mac builds: there wasn't a hang, but there was incorrect behavior on alternate attempts to export presets. Sometimes, instead of (correctly) giving a file overwrite warning, there was instead a message box about failure to open a non-existent file path, which had the last path component duplicated.
This commit is contained in:
parent
c1ce3c74c4
commit
da2e02242f
@ -35,6 +35,7 @@
|
|||||||
#include "../Shuttle.h"
|
#include "../Shuttle.h"
|
||||||
#include "../ViewInfo.h"
|
#include "../ViewInfo.h"
|
||||||
#include "../WaveTrack.h"
|
#include "../WaveTrack.h"
|
||||||
|
#include "../wxFileNameWrapper.h"
|
||||||
#include "../widgets/ProgressDialog.h"
|
#include "../widgets/ProgressDialog.h"
|
||||||
#include "../ondemand/ODManager.h"
|
#include "../ondemand/ODManager.h"
|
||||||
#include "../tracks/playabletrack/wavetrack/ui/WaveTrackView.h"
|
#include "../tracks/playabletrack/wavetrack/ui/WaveTrackView.h"
|
||||||
@ -667,9 +668,7 @@ void Effect::ExportPresets()
|
|||||||
GetAutomationParameters(params);
|
GetAutomationParameters(params);
|
||||||
params = GetSymbol().Internal() + ":" + params;
|
params = GetSymbol().Internal() + ":" + params;
|
||||||
|
|
||||||
wxFileName path;
|
auto path = FileNames::DefaultToDocumentsFolder(wxT("Presets/Path"));
|
||||||
|
|
||||||
path = gPrefs->Read(wxT("Presets/Path"), wxEmptyString);
|
|
||||||
|
|
||||||
wxFileDialog dlog(NULL,
|
wxFileDialog dlog(NULL,
|
||||||
_("Export Effect Parameters"),
|
_("Export Effect Parameters"),
|
||||||
@ -683,7 +682,7 @@ void Effect::ExportPresets()
|
|||||||
}
|
}
|
||||||
|
|
||||||
path = dlog.GetPath();
|
path = dlog.GetPath();
|
||||||
gPrefs->Write(wxT("Presets/Path"), path.GetFullPath());
|
gPrefs->Write(wxT("Presets/Path"), path.GetPath());
|
||||||
|
|
||||||
// Create/Open the file
|
// Create/Open the file
|
||||||
wxFFile f(path.GetFullPath(), wxT("wb"));
|
wxFFile f(path.GetFullPath(), wxT("wb"));
|
||||||
@ -717,9 +716,8 @@ void Effect::ExportPresets()
|
|||||||
void Effect::ImportPresets()
|
void Effect::ImportPresets()
|
||||||
{
|
{
|
||||||
wxString params;
|
wxString params;
|
||||||
wxFileName path;
|
|
||||||
|
|
||||||
path = gPrefs->Read(wxT("Presets/Path"), wxEmptyString);
|
auto path = FileNames::DefaultToDocumentsFolder(wxT("Presets/Path"));
|
||||||
|
|
||||||
wxFileDialog dlog(NULL,
|
wxFileDialog dlog(NULL,
|
||||||
_("Import Effect Parameters"),
|
_("Import Effect Parameters"),
|
||||||
@ -736,7 +734,7 @@ void Effect::ImportPresets()
|
|||||||
if( !path.IsOk())
|
if( !path.IsOk())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gPrefs->Write(wxT("Presets/Path"), path.GetFullPath());
|
gPrefs->Write(wxT("Presets/Path"), path.GetPath());
|
||||||
|
|
||||||
wxFFile f(path.GetFullPath());
|
wxFFile f(path.GetFullPath());
|
||||||
if (f.IsOpened()) {
|
if (f.IsOpened()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user