Bug 2655 - Import Audio command can import open projects and can import a project into itself
This commit is contained in:
parent
67dff35a12
commit
ab30778306
|
@ -587,8 +587,9 @@ bool ProjectFileManager::SaveCopy(const FilePath &fileName /* = wxT("") */)
|
||||||
{
|
{
|
||||||
// JKC: I removed 'wxFD_OVERWRITE_PROMPT' because we are checking
|
// JKC: I removed 'wxFD_OVERWRITE_PROMPT' because we are checking
|
||||||
// for overwrite ourselves later, and we disallow it.
|
// for overwrite ourselves later, and we disallow it.
|
||||||
// We disallow overwrite because we would have to DELETE the many
|
// Previously we disallowed overwrite because we would have had
|
||||||
// smaller files too, or prompt to move them.
|
// to DELETE the many smaller files too, or prompt to move them.
|
||||||
|
// Maybe we could allow it now that we have aup3 format?
|
||||||
fName = FileNames::SelectFile(FileNames::Operation::Export,
|
fName = FileNames::SelectFile(FileNames::Operation::Export,
|
||||||
title,
|
title,
|
||||||
filename.GetPath(),
|
filename.GetPath(),
|
||||||
|
@ -1172,6 +1173,7 @@ bool ProjectFileManager::Import(
|
||||||
TrackHolders newTracks;
|
TrackHolders newTracks;
|
||||||
TranslatableString errorMessage;
|
TranslatableString errorMessage;
|
||||||
|
|
||||||
|
#ifdef EXPERIMENTAL_IMPORT_AUP3
|
||||||
// Handle AUP3 ("project") files directly
|
// Handle AUP3 ("project") files directly
|
||||||
if (fileName.AfterLast('.').IsSameAs(wxT("aup3"), false)) {
|
if (fileName.AfterLast('.').IsSameAs(wxT("aup3"), false)) {
|
||||||
if (ImportProject(project, fileName)) {
|
if (ImportProject(project, fileName)) {
|
||||||
|
@ -1205,6 +1207,7 @@ bool ProjectFileManager::Import(
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
// Backup Tags, before the import. Be prepared to roll back changes.
|
// Backup Tags, before the import. Be prepared to roll back changes.
|
||||||
|
@ -1216,11 +1219,22 @@ bool ProjectFileManager::Import(
|
||||||
auto newTags = oldTags->Duplicate();
|
auto newTags = oldTags->Duplicate();
|
||||||
Tags::Set( project, newTags );
|
Tags::Set( project, newTags );
|
||||||
|
|
||||||
bool success = Importer::Get().Import(project, fileName,
|
bool success = true;
|
||||||
|
|
||||||
|
#ifndef EXPERIMENTAL_IMPORT_AUP3
|
||||||
|
// Handle AUP3 ("project") files specially
|
||||||
|
if (fileName.AfterLast('.').IsSameAs(wxT("aup3"), false)) {
|
||||||
|
errorMessage = XO( "Cannot import aup3 format. Use Open instead");
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if( success ){
|
||||||
|
success = Importer::Get().Import(project, fileName,
|
||||||
&WaveTrackFactory::Get( project ),
|
&WaveTrackFactory::Get( project ),
|
||||||
newTracks,
|
newTracks,
|
||||||
newTags.get(),
|
newTags.get(),
|
||||||
errorMessage);
|
errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
if (!errorMessage.empty()) {
|
if (!errorMessage.empty()) {
|
||||||
// Error message derived from Importer::Import
|
// Error message derived from Importer::Import
|
||||||
|
|
Loading…
Reference in New Issue