mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-30 15:49:41 +02:00
Export failure messages name the file, exactly as with FileException
This commit is contained in:
parent
d225d24092
commit
f07fd5d8bc
@ -27,12 +27,7 @@ TranslatableString FileException::ErrorMessage() const
|
||||
format = XO("Audacity failed to read from a file in %s.");
|
||||
break;
|
||||
case Cause::Write:
|
||||
format =
|
||||
XO("Audacity failed to write to a file.\n"
|
||||
"Perhaps %s is not writable or the disk is full.\n"
|
||||
"For tips on freeing up space, click the help button."
|
||||
);
|
||||
break;
|
||||
return WriteFailureMessage(fileName);
|
||||
case Cause::Rename:
|
||||
format =
|
||||
XO("Audacity successfully wrote a file in %s but failed to rename it as %s.");
|
||||
@ -82,3 +77,12 @@ wxString FileException::AbbreviatePath( const wxFileName &fileName )
|
||||
#endif
|
||||
return target;
|
||||
}
|
||||
|
||||
TranslatableString
|
||||
FileException::WriteFailureMessage(const wxFileName &fileName)
|
||||
{
|
||||
return XO("Audacity failed to write to a file.\n"
|
||||
"Perhaps %s is not writable or the disk is full.\n"
|
||||
"For tips on freeing up space, click the help button."
|
||||
).Format(AbbreviatePath(fileName));
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
~FileException() override;
|
||||
|
||||
static wxString AbbreviatePath(const wxFileName &fileName);
|
||||
static TranslatableString WriteFailureMessage(const wxFileName &fileName);
|
||||
|
||||
protected:
|
||||
//! %Format an error message appropriate for the @ref Cause.
|
||||
|
@ -1526,14 +1526,11 @@ void ShowExportErrorDialog(wxString ErrorCode,
|
||||
);
|
||||
}
|
||||
|
||||
void ShowDiskFullExportErrorDialog()
|
||||
void ShowDiskFullExportErrorDialog(const wxFileNameWrapper &fileName)
|
||||
{
|
||||
ShowErrorDialog(nullptr,
|
||||
XO("Warning"),
|
||||
XO("Audacity failed to write to a file.\n"
|
||||
"Perhaps the file is not writable or the disk is full.\n"
|
||||
"For tips on freeing up space, click the help button."
|
||||
),
|
||||
FileException::WriteFailureMessage(fileName),
|
||||
"Error:_Disk_full_or_not_writable"
|
||||
);
|
||||
}
|
||||
|
@ -332,6 +332,6 @@ void ShowExportErrorDialog(wxString ErrorCode,
|
||||
TranslatableString message = AudacityExportMessageStr(),
|
||||
const TranslatableString& caption = AudacityExportCaptionStr());
|
||||
|
||||
void ShowDiskFullExportErrorDialog();
|
||||
void ShowDiskFullExportErrorDialog(const wxFileNameWrapper &fileName);
|
||||
|
||||
#endif
|
||||
|
@ -958,7 +958,7 @@ bool ExportFFmpeg::EncodeAudioFrame(int16_t *pFrame, size_t frameSize)
|
||||
// Write the encoded audio frame to the output file.
|
||||
if ((ret = av_interleaved_write_frame(mEncFormatCtx.get(), &pkt)) < 0)
|
||||
{
|
||||
ShowDiskFullExportErrorDialog();
|
||||
ShowDiskFullExportErrorDialog(mName);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1038,7 +1038,7 @@ ProgressResult ExportFFmpeg::Export(AudacityProject *project,
|
||||
if (!EncodeAudioFrame(
|
||||
pcmBuffer, (pcmNumSamples)*sizeof(int16_t)*mChannels)) {
|
||||
// All errors should already have been reported.
|
||||
//ShowDiskFullExportErrorDialog();
|
||||
//ShowDiskFullExportErrorDialog(mName);
|
||||
updateResult = ProgressResult::Cancelled;
|
||||
break;
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ ProgressResult ExportFLAC::Export(AudacityProject *project,
|
||||
reinterpret_cast<FLAC__int32**>( tmpsmplbuf.get() ),
|
||||
samplesThisRun) ) {
|
||||
// TODO: more precise message
|
||||
ShowDiskFullExportErrorDialog();
|
||||
ShowDiskFullExportErrorDialog(fName);
|
||||
updateResult = ProgressResult::Cancelled;
|
||||
break;
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ ProgressResult ExportMP2::Export(AudacityProject *project,
|
||||
|
||||
if ( outFile.Write(mp2Buffer.get(), mp2BufferNumBytes).GetLastError() ) {
|
||||
// TODO: more precise message
|
||||
ShowDiskFullExportErrorDialog();
|
||||
ShowDiskFullExportErrorDialog(fName);
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
|
@ -1963,7 +1963,7 @@ ProgressResult ExportMP3::Export(AudacityProject *project,
|
||||
|
||||
if (bytes > (int)outFile.Write(buffer.get(), bytes)) {
|
||||
// TODO: more precise message
|
||||
ShowDiskFullExportErrorDialog();
|
||||
ShowDiskFullExportErrorDialog(fName);
|
||||
updateResult = ProgressResult::Cancelled;
|
||||
break;
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ ProgressResult ExportOGG::Export(AudacityProject *project,
|
||||
if ( outFile.Write(page.header, page.header_len).GetLastError() ||
|
||||
outFile.Write(page.body, page.body_len).GetLastError()) {
|
||||
// TODO: more precise message
|
||||
ShowDiskFullExportErrorDialog();
|
||||
ShowDiskFullExportErrorDialog(fName);
|
||||
return ProgressResult::Cancelled;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user