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