Audacity 3.2.0
FileException.cpp
Go to the documentation of this file.
1
10#include "FileException.h"
11#include "FileNames.h"
12
13#include "Prefs.h"
14
16{
17}
18
20{
22 switch (cause) {
23 case Cause::Open:
24 format = XO("Audacity failed to open a file in %s.");
25 break;
26 case Cause::Read:
27 format = XO("Audacity failed to read from a file in %s.");
28 break;
29 case Cause::Write:
31 case Cause::Rename:
32 format =
33XO("Audacity successfully wrote a file in %s but failed to rename it as %s.");
34 default:
35 break;
36 }
37
38 return format.Format(
40}
41
43{
44 switch (cause) {
45 case Cause::Open:
46 case Cause::Read:
47 return "Error:_Opening_or_reading_file";
48 break;
49 case Cause::Write:
50 case Cause::Rename:
51 return "Error:_Disk_full_or_not_writable";
52 default:
53 break;
54 }
55
56 return "";
57}
58
60FileException::WriteFailureMessage(const wxFileName &fileName)
61{
62 return XO("Audacity failed to write to a file.\n"
63 "Perhaps %s is not writable or the disk is full."
65}
MessageBoxException for failures of file operations.
XO("Cut/Copy/Paste")
TranslatableString ErrorMessage() const override
Format an error message appropriate for the Cause.
wxFileName renameTarget
Definition: FileException.h:64
wxFileName fileName
Definition: FileException.h:63
~FileException() override
wxString ErrorHelpUrl() const override
@ Write
most important to detect when storage space is exhausted
@ Rename
involves two filenames
static TranslatableString WriteFailureMessage(const wxFileName &fileName)
Holds a msgid for the translation catalog; may also bind format arguments.
FILES_API wxString AbbreviatePath(const wxFileName &fileName)
Give enough of the path to identify the device. (On Windows, drive letter plus ':')