1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-31 16:09:28 +02:00

Remember Save/SaveAs Path.

Previously we relied on Windows doing this.  With the fix to now use Documents directory, if none was set, Windows no longer remembers the directory.  So now we remember it instead.
This commit is contained in:
James Crook 2017-01-30 17:31:11 +00:00
parent 5a5a285cc9
commit 0cb89a895a

View File

@ -4180,15 +4180,16 @@ bool AudacityProject::SaveAs(const wxString & newFileName, bool bWantSaveCompres
bool AudacityProject::SaveAs(bool bWantSaveCompressed /*= false*/)
{
TitleRestorer Restorer(this); // RAII
bool bHasPath = true;
wxFileName filename(mFileName);
// Bug 1304: Set a default file path if none was given. For Save/SaveAs
if( filename.GetFullPath().IsEmpty() ){
bHasPath = false;
filename.AssignHomeDir();
#ifdef __WIN32__
filename.SetPath(filename.GetPath() + "\\Documents");
filename.SetPath(gPrefs->Read( wxT("/SaveAs/Path"), filename.GetPath() + "\\Documents"));
#else
filename.SetPath(filename.GetPath() + "/Documents");
filename.SetPath(gPrefs->Read( wxT("/SaveAs/Path"), filename.GetPath() + "/Documents"));
#endif
}
@ -4260,6 +4261,11 @@ For an audio file that will open in other apps, use 'Export'.\n"),
if (success) {
wxGetApp().AddFileToHistory(mFileName);
if( !bHasPath )
{
gPrefs->Write( wxT("/SaveAs/Path"), filename.GetPath());
gPrefs->Flush();
}
}
if (!success || bWantSaveCompressed) // bWantSaveCompressed doesn't actually change current project.
{