1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 14:02:57 +02:00

Simplify the error messages in case of disk i/o exceptions

This commit is contained in:
Paul Licameli
2017-07-17 20:44:49 -04:00
parent a9a6f01214
commit 9b35792685

View File

@@ -24,22 +24,30 @@ wxString FileException::ErrorMessage() const
wxString format; wxString format;
switch (cause) { switch (cause) {
case Cause::Open: case Cause::Open:
format = _("Audacity failed to open a file at %s.\n"); format = _("Audacity failed to open a file in %s.");
break; break;
case Cause::Read: case Cause::Read:
format = _("Audacity failed to read from a file at %s.\n"); format = _("Audacity failed to read from a file in %s.");
break; break;
case Cause::Write: case Cause::Write:
format = _( format = _("Audacity failed to write to a file in %s.");
"Audacity failed to write to a file at %s.\nAttempt this operation again after removing unnecessary files.\nOne way to do that is with the Discard buttons in the History dialog.\nSee the View menu.");
break; break;
case Cause::Rename: case Cause::Rename:
format = _( format =
"Audacity successfully wrote the file %s but failed to rename it as %s."); _("Audacity successfully wrote a file in %s but failed to rename it as %s.");
default: default:
break; break;
} }
wxString target = fileName.GetVolume();
if (target.empty()) {
// Shorten the path, arbitrarily to 3 components
auto path = fileName;
path.SetFullName(wxString{});
while(path.GetDirCount() > 3)
path.RemoveLastDir();
target = path.GetFullPath();
}
return wxString::Format( return wxString::Format(
format, fileName.GetFullPath(), renameTarget.GetFullPath() ); format, target, renameTarget.GetFullName() );
} }