From 32212d7fcd0ec6a0cf9ddcf333d4d7bf9a9b770d Mon Sep 17 00:00:00 2001 From: Steve Daulton Date: Tue, 15 May 2018 20:29:51 +0100 Subject: [PATCH] Dissallow OD loading for lossless copy projects Opening a backup copy project converts to a normal project. We copy in the dependencies when we convert to ensure that the project remains complete and self contained (which is not guaranteed with OD loading). --- src/Project.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Project.cpp b/src/Project.cpp index aafb85b21..884ee29a1 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -3115,8 +3115,25 @@ void AudacityProject::OpenFile(const wxString &fileNameArg, bool addtohistory) XMLFileReader xmlFile; + // 'Lossless copy' projects have dependencies. We need to always copy-in + // these dependencies when converting to a normal project. + wxString oldAction = gPrefs->Read(wxT("/FileFormats/CopyOrEditUncompressedData"), wxT("copy")); + bool oldAsk = gPrefs->Read(wxT("/Warnings/CopyOrEditUncompressedDataAsk"), true)?true:false; + if (oldAction != wxT("copy")) + gPrefs->Write(wxT("/FileFormats/CopyOrEditUncompressedData"), wxT("copy")); + if (oldAsk) + gPrefs->Write(wxT("/Warnings/CopyOrEditUncompressedDataAsk"), (long) false); + gPrefs->Flush(); + bool bParseSuccess = xmlFile.Parse(this, fileName); + // and restore old settings if necessary. + if (oldAction != wxT("copy")) + gPrefs->Write(wxT("/FileFormats/CopyOrEditUncompressedData"), oldAction); + if (oldAsk) + gPrefs->Write(wxT("/Warnings/CopyOrEditUncompressedDataAsk"), (long) true); + gPrefs->Flush(); + // Clean up now unused recording recovery handler if any mRecordingRecoveryHandler.reset();