From a5594537bbd199ae0238603b3f14f49dea39343d Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Thu, 3 Aug 2017 07:55:51 -0400 Subject: [PATCH] "/DefaultOpenPath" is now in only one place --- src/AudacityApp.cpp | 4 +--- src/Menus.cpp | 3 +-- src/Project.cpp | 3 +-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/AudacityApp.cpp b/src/AudacityApp.cpp index 802537476..bbffdb312 100644 --- a/src/AudacityApp.cpp +++ b/src/AudacityApp.cpp @@ -774,9 +774,7 @@ bool AudacityApp::MRUOpen(const wxString &fullPathStr) { // verify that the file exists if (wxFile::Exists(fullPathStr)) { - if (!gPrefs->Write(wxT("/DefaultOpenPath"), wxPathOnly(fullPathStr)) || - !gPrefs->Flush()) - return false; + FileNames::UpdateDefaultPath(FileNames::Operation::Open, fullPathStr); // Make sure it isn't already open. // Test here even though AudacityProject::OpenFile() also now checks, because diff --git a/src/Menus.cpp b/src/Menus.cpp index ebbf094e7..a1fa03c84 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -6731,8 +6731,7 @@ void AudacityProject::OnImport() for (size_t ff = 0; ff < selectedFiles.GetCount(); ff++) { wxString fileName = selectedFiles[ff]; - wxString path = ::wxPathOnly(fileName); - gPrefs->Write(wxT("/DefaultOpenPath"), path); + FileNames::UpdateDefaultPath(FileNames::Operation::Open, fileName); Import(fileName); } diff --git a/src/Project.cpp b/src/Project.cpp index 75e9917a9..144079c8f 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -2927,8 +2927,7 @@ void AudacityProject::OpenFiles(AudacityProject *proj) if (AudacityProject::IsAlreadyOpen(fileName)) continue; // Skip ones that are already open. - gPrefs->Write(wxT("/DefaultOpenPath"), wxPathOnly(fileName)); - gPrefs->Flush(); + FileNames::UpdateDefaultPath(FileNames::Operation::Open, fileName); // DMM: If the project is dirty, that means it's been touched at // all, and it's not safe to open a NEW project directly in its