From 5e31b813d2f7b84b1e7d3d8814498820a8bee4a4 Mon Sep 17 00:00:00 2001 From: "v.audacity" Date: Fri, 25 Mar 2011 23:13:07 +0000 Subject: [PATCH] Bug 137 (P2) - Unreliable project re-opening with orphaned and missing blockfile errors Apply Michael's patch per http://bugzilla.audacityteam.org/show_bug.cgi?id=137#c15 and http://bugzilla.audacityteam.org/show_bug.cgi?id=137#c19. --- src/DirManager.cpp | 2 -- src/Project.cpp | 14 +++++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/DirManager.cpp b/src/DirManager.cpp index 1ed0cb698..a4fb80ace 100644 --- a/src/DirManager.cpp +++ b/src/DirManager.cpp @@ -417,10 +417,8 @@ bool DirManager::SetProject(wxString& newProjPath, wxString& newProjName, const #endif } else { - #ifndef __WXMAC__ if (!wxDirExists(projFull)) return false; - #endif } /* Move all files into this new directory. Files which are diff --git a/src/Project.cpp b/src/Project.cpp index 01daa8f11..75f81fdb4 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -2681,14 +2681,22 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs) } if (!projName.IsEmpty()) - { + { + // First try to load the data files based on the _data dir given in the .aup file + // If this fails then try to use the filename of the .aup as the base directory + // This is because unzipped projects e.g. those that get transfered between mac-pc + // have encoding issues and end up expanding the wrong filenames for certain + // international characters (such as capital 'A' with an umlaut.) if (!mDirManager->SetProject(projPath, projName, false)) { - wxMessageBox(wxString::Format(_("Couldn't find the project data folder: \"%s\""), + projName = GetName() + wxT("_data"); + if (!mDirManager->SetProject(projPath, projName, false)) { + wxMessageBox(wxString::Format(_("Couldn't find the project data folder: \"%s\""), projName.c_str()), _("Error opening project"), wxOK | wxCENTRE, this); - return false; + return false; + } } }