1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-25 15:53:52 +02:00

Bug 328 (P2) - do not allow writing to paths that are also missing alias files.

This commit is contained in:
mchinen
2011-04-02 23:56:02 +00:00
parent 3a7d00394f
commit 26c84929a6
3 changed files with 47 additions and 17 deletions

View File

@@ -73,6 +73,7 @@
#include "../widgets/Warning.h"
#include "../AColor.h"
#include "../TimeTrack.h"
#include "../Dependencies.h"
// Callback to display format options
static void ExportCallback(void *cbdata, int index)
@@ -635,6 +636,29 @@ bool Exporter::GetFilename()
continue;
}
// Check to see if we are writing to a path that a missing aliased file existed at.
// This causes problems for the exporter, so we don't allow it.
// Overwritting non-missing aliased files is okay.
// Also, this can only happen for uncompressed audio.
size_t i;
bool overwritingMissingAlias;
overwritingMissingAlias = false;
for (size_t i = 0; i < gAudacityProjects.GetCount(); i++) {
AliasedFileArray aliasedFiles;
FindDependencies(gAudacityProjects[i], &aliasedFiles);
if (mFilename.GetFullPath() == aliasedFiles[i].mFileName.GetFullPath() &&
!mFilename.FileExists()) {
// Warn and return to the dialog
wxMessageBox(_("You are attempting to overwrite an aliased file that is missing.\n\
The file cannot be written because the path is needed to restore the original audio to the project.\n\
You can see the missing files in File > Check Dependencies.\n\
If you still wish to export, please choose a different filename."));
overwritingMissingAlias = true;
}
}
if (overwritingMissingAlias)
continue;
if (mFilename.FileExists()) {
wxString prompt;