MCPcopy Create free account
hub / github.com/audacity/audacity / SaveAs

Method SaveAs

src/ProjectFileManager.cpp:443–470  ·  view source on GitHub ↗

This version of SaveAs is invoked only from scripting and does not prompt for a file name

Source from the content-addressed store, hash-verified

441// This version of SaveAs is invoked only from scripting and does not
442// prompt for a file name
443bool ProjectFileManager::SaveAs(const FilePath &newFileName, bool addToHistory /*= true*/)
444{
445 auto &project = mProject;
446 auto &projectFileIO = ProjectFileIO::Get( project );
447
448 auto oldFileName = projectFileIO.GetFileName();
449
450 bool bOwnsNewName = !projectFileIO.IsTemporary() && (oldFileName == newFileName);
451 //check to see if the NEW project file already exists.
452 //We should only overwrite it if this project already has the same name, where the user
453 //simply chose to use the save as command although the save command would have the effect.
454 if( !bOwnsNewName && wxFileExists(newFileName)) {
455 AudacityMessageDialog m(
456 nullptr,
457 XO("The project was not saved because the file name provided would overwrite another project.\nPlease try again and select an original name."),
458 XO("Error Saving Project"),
459 wxOK|wxICON_ERROR );
460 m.ShowModal();
461 return false;
462 }
463
464 auto success = DoSave(newFileName, !bOwnsNewName);
465 if (success && addToHistory) {
466 FileHistory::Global().Append( projectFileIO.GetFileName() );
467 }
468
469 return(success);
470}
471
472bool ProjectFileManager::SaveAs(bool allowOverwrite /* = false */)
473{

Callers 3

ResaveLocallyFunction · 0.80
ApplyMethod · 0.80
OnSaveAsFunction · 0.80

Calls 13

GetFunction · 0.85
SelectFileFunction · 0.85
AudacityMessageBoxFunction · 0.85
IsTemporaryMethod · 0.80
GetProjectNameMethod · 0.80
GetFullNameMethod · 0.80
OnCloseFunction · 0.50
ShowModalMethod · 0.45
AppendMethod · 0.45
SetPathMethod · 0.45
SetNameMethod · 0.45
GetPathMethod · 0.45

Tested by

no test coverage detected