Audacity  3.0.3
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 =
33 XO("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 
60 FileException::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.\n"
64  "For tips on freeing up space, click the help button."
66 }
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
FileNames::AbbreviatePath
FILES_API wxString AbbreviatePath(const wxFileName &fileName)
Give enough of the path to identify the device. (On Windows, drive letter plus ':')
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:19
FileException::~FileException
~FileException() override
Definition: FileException.cpp:15
FileException::Cause::Open
@ Open
format
int format
Definition: ExportPCM.cpp:56
FileNames.h
FileException::WriteFailureMessage
static TranslatableString WriteFailureMessage(const wxFileName &fileName)
Definition: FileException.cpp:60
Prefs.h
FileException::renameTarget
wxFileName renameTarget
Definition: FileException.h:64
FileException::ErrorHelpUrl
wxString ErrorHelpUrl() const override
Definition: FileException.cpp:42