1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-25 15:53:52 +02:00

Defaulting of file paths to Documents is defined in just one place

This commit is contained in:
Paul Licameli
2017-08-01 15:11:56 -04:00
parent d7ac0d30db
commit a9d4c2c05b
5 changed files with 30 additions and 30 deletions

View File

@@ -69,6 +69,7 @@
#include "../widgets/Warning.h"
#include "../AColor.h"
#include "../Dependencies.h"
#include "../FileNames.h"
//----------------------------------------------------------------------------
// ExportPlugin
@@ -524,18 +525,7 @@ bool Exporter::GetFilename()
wxString defext = mPlugins[mFormat]->GetExtension(mSubFormat).Lower();
//Bug 1304: Set a default path if none was given. For Export.
#ifdef __WIN32__
wxFileName tmpFile;
tmpFile.AssignHomeDir();
wxString tmpDirLoc = tmpFile.GetPath(wxPATH_GET_VOLUME);
mFilename.SetPath(gPrefs->Read(wxT("/Export/Path"), tmpDirLoc + "\\Documents\\Audacity"));
// The path might not exist.
// There is no error if the path could not be created. That's OK.
// The dialog that Audacity offers will allow the user to select a valid directory.
mFilename.Mkdir(0755, wxPATH_MKDIR_FULL);
#else
mFilename.SetPath(gPrefs->Read(wxT("/Export/Path"), wxT("~/Documents")));
#endif
mFilename = FileNames::DefaultToDocumentsFolder(wxT("/Export/Path"));
mFilename.SetName(mProject->GetName());
if (mFilename.GetName().empty())
mFilename.SetName(_("untitled"));

View File

@@ -241,13 +241,7 @@ void ExportMultiple::PopulateOrExchange(ShuttleGui& S)
// Bug 1304: Set the default file path. It's used if none stored in config.
wxFileName filename("foo");
filename.AssignHomeDir();
#ifdef __WIN32__
filename.SetPath(filename.GetPath() + "\\Documents\\Audacity");
#else
filename.SetPath(filename.GetPath() + "/Documents");
#endif
auto filename = FileNames::DefaultToDocumentsFolder(wxT("/Export/Path"));
wxString DefaultPath = filename.GetPath();
if (mPluginIndex == -1)
@@ -268,7 +262,7 @@ void ExportMultiple::PopulateOrExchange(ShuttleGui& S)
mDir = S.Id(DirID)
.TieTextBox(_("Folder:"),
wxT("/Export/MultiplePath"),
gPrefs->Read(wxT("/Export/Path"), DefaultPath ),
DefaultPath,
64);
S.Id(ChooseID).AddButton(_("Choose..."));
S.Id(CreateID).AddButton(_("Create"));