1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 16:40:07 +02:00

Fix: "\" in file name gives disk full error. Now we complain about a non-existent directory instead. (Bug 120).

This commit is contained in:
james.k.crook 2011-02-12 14:25:51 +00:00
parent 91b1124a39
commit 6bdfb13b45
2 changed files with 41 additions and 20 deletions

View File

@ -2945,6 +2945,30 @@ void AudacityProject::WriteXML(XMLWriter &xmlFile)
} }
} }
// Lock all blocks in all tracks of the last saved version
void AudacityProject::LockAllBlocks()
{
TrackListIterator iter(mLastSavedTracks);
Track *t = iter.First();
while (t) {
if (t->GetKind() == Track::Wave)
((WaveTrack *) t)->Lock();
t = iter.Next();
}
}
// Unlock all blocks in all tracks of the last saved version
void AudacityProject::UnlockAllBlocks()
{
TrackListIterator iter(mLastSavedTracks);
Track *t = iter.First();
while (t) {
if (t->GetKind() == Track::Wave)
((WaveTrack *) t)->Unlock();
t = iter.Next();
}
}
bool AudacityProject::Save(bool overwrite /* = true */ , bool AudacityProject::Save(bool overwrite /* = true */ ,
bool fromSaveAs /* = false */, bool fromSaveAs /* = false */,
bool bWantSaveCompressed /*= false*/) bool bWantSaveCompressed /*= false*/)
@ -3025,6 +3049,16 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
mWantSaveCompressed = bWantSaveCompressed; mWantSaveCompressed = bWantSaveCompressed;
bool success = false; bool success = false;
if( !wxDir::Exists( projPath ) ){
wxMessageBox(wxString::Format(
_("Could not save project. Path not found. Try creating \ndirectory \"%s\" before saving project with this name."),
projPath.c_str()),
_("Error saving project"),
wxICON_ERROR, this);
return false;
}
if (bWantSaveCompressed) if (bWantSaveCompressed)
{ {
//v Move this condition into SaveCompressedWaveTracks() if want to support other formats. //v Move this condition into SaveCompressedWaveTracks() if want to support other formats.
@ -3041,30 +3075,15 @@ bool AudacityProject::Save(bool overwrite /* = true */ ,
// (Otherwise the new project would be fine, but the old one would // (Otherwise the new project would be fine, but the old one would
// be empty of all of its files.) // be empty of all of its files.)
// Lock all blocks in all tracks of the last saved version if (mLastSavedTracks && !overwrite)
if (mLastSavedTracks && !overwrite) { LockAllBlocks();
TrackListIterator iter(mLastSavedTracks);
Track *t = iter.First();
while (t) {
if (t->GetKind() == Track::Wave)
((WaveTrack *) t)->Lock();
t = iter.Next();
}
}
// This renames the project directory, and moves or copies // This renames the project directory, and moves or copies
// all of our block files over. // all of our block files over.
success = mDirManager->SetProject(projPath, projName, !overwrite); success = mDirManager->SetProject(projPath, projName, !overwrite);
// Unlock all blocks in all tracks of the last saved version if (mLastSavedTracks && !overwrite)
if (mLastSavedTracks && !overwrite) { UnlockAllBlocks();
TrackListIterator iter(mLastSavedTracks);
Track *t = iter.First();
while (t) {
if (t->GetKind() == Track::Wave)
((WaveTrack *) t)->Unlock();
t = iter.Next();
}
}
} }
if (!success) { if (!success) {

View File

@ -198,6 +198,8 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
void AddImportedTracks(wxString fileName, void AddImportedTracks(wxString fileName,
Track **newTracks, int numTracks); Track **newTracks, int numTracks);
void LockAllBlocks();
void UnlockAllBlocks();
bool Save(bool overwrite = true, bool fromSaveAs = false, bool bWantSaveCompressed = false); bool Save(bool overwrite = true, bool fromSaveAs = false, bool bWantSaveCompressed = false);
bool SaveAs(bool bWantSaveCompressed = false); bool SaveAs(bool bWantSaveCompressed = false);
#ifdef USE_LIBVORBIS #ifdef USE_LIBVORBIS