diff --git a/src/BlockFile.cpp b/src/BlockFile.cpp index 98de50178..f8176b852 100644 --- a/src/BlockFile.cpp +++ b/src/BlockFile.cpp @@ -114,7 +114,9 @@ BlockFile::~BlockFile() /// Returns the file name of the disk file associated with this /// BlockFile. Not all BlockFiles store their sample data here, -/// but all BlockFiles have at least their summary data here. +/// but most BlockFiles have at least their summary data here. +/// (some, i.e. SilentBlockFiles, do not correspond to a file on +/// disk and have empty file names) wxFileName BlockFile::GetFileName() { return mFileName; diff --git a/src/BlockFile.h b/src/BlockFile.h index 15f334482..021461bb7 100644 --- a/src/BlockFile.h +++ b/src/BlockFile.h @@ -77,6 +77,8 @@ class BlockFile { virtual void SaveXML(XMLWriter &xmlFile) = 0; /// Gets the filename of the disk file associated with this BlockFile + /// (can be empty -- some BlockFiles, like SilentBlockFile, correspond to + /// no file on disk) virtual wxFileName GetFileName(); virtual void SetFileName(wxFileName &name); diff --git a/src/DirManager.cpp b/src/DirManager.cpp index 696715a39..cd772a0c8 100644 --- a/src/DirManager.cpp +++ b/src/DirManager.cpp @@ -973,6 +973,11 @@ bool DirManager::HandleXMLTag(const wxChar *tag, const wxChar **attrs) bool DirManager::MoveToNewProjectDirectory(BlockFile *f) { + // Check that this BlockFile corresponds to a file on disk + if (f->GetFileName().GetName().IsEmpty()) { + return true; + } + wxFileName newFileName; wxFileName oldFileName=f->GetFileName(); AssignFile(newFileName,f->GetFileName().GetFullName(),FALSE); @@ -1025,6 +1030,10 @@ bool DirManager::MoveToNewProjectDirectory(BlockFile *f) bool DirManager::CopyToNewProjectDirectory(BlockFile *f) { + // Check that this BlockFile corresponds to a file on disk + if (f->GetFileName().GetName().IsEmpty()) { + return true; + } wxFileName newFileName; wxFileName oldFileName=f->GetFileName(); AssignFile(newFileName,f->GetFileName().GetFullName(),FALSE);